Ok so I am using the ajax control toolkit tabcontainer with 5 tab panels inside of it. Each tab contains areas where one must input information. The page also contains add, edit, and delete buttons with gridviews above them.
What I am trying to do is to make the user save or cancel changes when they change the activetab. I am using a javascript confirm box but I need to try to retrieve the value of what is pressed from the javascript box to decide whether to discard the changes or stay on the page and make the user finish the input. Is there any way to save the value from the javascript box into a variable so or must i try something else?
If you need any further explanation i will be more than glad to respond.
PS I wasnt sure whether to post this in the javascript section or the asp.net section since im using asp.net with c#.
This is kinda what im using but would like to turn it into a confirm box and pull the true or false value.
What I am trying to do is to make the user save or cancel changes when they change the activetab. I am using a javascript confirm box but I need to try to retrieve the value of what is pressed from the javascript box to decide whether to discard the changes or stay on the page and make the user finish the input. Is there any way to save the value from the javascript box into a variable so or must i try something else?
If you need any further explanation i will be more than glad to respond.
PS I wasnt sure whether to post this in the javascript section or the asp.net section since im using asp.net with c#.
This is kinda what im using but would like to turn it into a confirm box and pull the true or false value.
Code:
protected void TabContainerContent_ActiveTabChanged(object sender, EventArgs e)
{
if (TabContainerContent.ActiveTabIndex != 0)
{
btnDelete.Visible = false;
btnDeleteOthers.Visible = true;
}
else
{
btnDelete.Visible = true;
btnDeleteOthers.Visible = false;
}
btnDeleteOthers.Enabled = false;
//check to make sure user has saved tab before moving on
if (Convert.ToString(Session["buttonpressed"]) == "Add" || Convert.ToString(Session["buttonpressed"]) == "Edit" && Convert.ToString(Session["savepressed"]) == "No")
{
string tmp = "";
tmp = "<script language='javascript'>";
tmp += "alert('You must save or cancel to continue');";
tmp += "</script>";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScript", tmp);
}
Session["savepressed"] = "No";
}
Comment