Wednesday, March 21, 2012

A lil tab issue

I have a selection of ajax tabs each containing diffrent gridviews of data. Each gridview has a template feild with a linkbutton inside of it, the link buttons command ends with a page reload if you will that looks something like this :


Response.Redirect("~/Home/Editor?pid=" + QueryStringPID);

When i click the linkbutton the page doesnt go back to the editor?pid=1 for example. even though that line is within the code... i dont understand it. i tryed putting an update panel within the tab to see if that would help but it doesnt seem to work. The link buttons on_click event isnt strickly an on_click as its a RowCommand. It simply checks the command name and changes it from 1 to 0 or 0 to 1, it worked perfectly well out side of the tab. which is confusing.

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
SqlConnection Connection = new SqlConnection(ConfigurationManager.ConnectionStrings["BlinkConnectionString"].ToString());
SqlCommand Command = new SqlCommand();
Command.Connection = Connection;
Connection.Open();
if (e.CommandName == "0")
{
Command.CommandText = "UPDATE Profile SET " + e.CommandArgument + " = '1' WHERE UserID = " + QueryStringPID;
Command.ExecuteNonQuery();
}
else if (e.CommandName == "1")
{
Command.CommandText = "UPDATE Profile SET " + e.CommandArgument + " = '0' WHERE UserID = " + QueryStringPID;
Command.ExecuteNonQuery();
}
Connection.Close();
Response.Redirect("~/Home/Editor?pid=" + QueryStringPID);
}

Any ideas all are welcome! thanks si!

ps does anyone know how to force a postback for an update panel? thanks si!

sorted it, no worries thanks for anyone who was making an attempt at sorting it! si!

No comments:

Post a Comment