0

How do you guys handle using the same form to input and edit data. I currently check to see if a param has been parsed in the form or querystring and action accordingly. e.g

string id = Request.QueryString.Get("id");

if(id == string.Empty){
  //new input
}else{
  //get data from database etc
  //populate form
}

2 Answers 2

1

Normally i use hidden text box to store current record id and check same way as you did. But difference is, I use post not get.

And also use dynamic submit destination - for insert or update functions

I am not sure its a best way to implement that

Sign up to request clarification or add additional context in comments.

1 Comment

I always use the same submit destination and just call an update or insert based on whether its new data or updating data.
0

Use Session, Session["ID"] = "ObjectID";

if(string.IsNullOrEmpty(Session["ID"])){
//new input
}else{
//get data from database etc
//populate form
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.