Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SaveNgo()
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
Miscellaneous
Thread ID:
00785001
Message ID:
00785120
Views:
13
>I have a button to Post a number of inserts to a dataset and then save the ds.
>
>Now I want to hit the back button?
>
>private void MmButton1_Click(object sender, System.EventArgs e)
>{
>saveNgo(); // sets ds and saves it back to db
>
>HtmlInputButton backbutton= new HtmlInputButton();
>backbutton.Attributes.Add("onclick", "history.go(-1)");
>this.Controls.Add(backbutton);
>
>How do I click this new button? Or if you have a better way of history.go(-1) I'm all eyes ;)
>
>TIA


One problem you may have with your approach is that if the update fails or the server is unavailable, the user is moved off the page with no knowledge of the problem. You would basically be hitting the server and then never sticking around to see what happend.

If you know where the user should go after saving their changes, you can direct them from the server side with a Response.Redirect(). If the URL is something that changes, you could get the referring URL, hold onto it , then redirect to that.
private void MmButton1_Click(object sender, System.EventArgs e)
{
bool goodsave = saveNgo();  // sets ds and saves it back to db
if(goodsave)
Response.Redirect("back button url")
else
Response.Redirect("problem url")
}
Chris
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform