user input handling
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");
开发者_如何学C
if(id == string.Empty){
//new input
}else{
//get data from database etc
//populate form
}
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
Use Session, Session["ID"] = "ObjectID";
if(string.IsNullOrEmpty(Session["ID"])){
//new input
}else{
//get data from database etc
//populate form
}
精彩评论