开发者

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
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜