Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SaveNgo()
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Divers
Thread ID:
00785001
Message ID:
00785120
Vues:
14
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform