Click to See Complete Forum and Search --> : Response.Reirect()...


Frank100
March 19th, 2009, 05:17 AM
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.Cells.Count > 0)
{
strGridValue = e.Row.Cells[0].Text;
if (strGridValue != "ID")
{
e.Row.Attributes.Add("ondblclick", "javascript:alert('" + strGridValue + "')");
Session.Add("Value", strGridValue);//This Line of code will work here?
Response.Redirect("Default.aspx");//This Line of code will work here?
}
}
}


This code is not working....Please help...

eclipsed4utoo
March 19th, 2009, 05:41 AM
what do you want the code to do? from the code that you posted, it looks like you want to redirect to a different page everytime a new row is loaded into the Grid. Though that is only going to work for the first row since it will redirect with the first row so it won't load the other rows.

Is that what you are wanting to happen?

Shuja Ali
March 19th, 2009, 02:18 PM
Do you want it this way. When a user clicks on any row of the gridview, the user should be taken to a new page.

IF that is the case, then my earlier link that I posted to your other thread would still work. Why are you using RowDatabound event to do this? You should look through the documentation of the GridView and associated events to understand which event would be suited for what.

Frank100
March 19th, 2009, 02:21 PM
Yes....I want to redirect from one page to other page with GridView cell value...(When user double click it)

Frank100
March 19th, 2009, 02:22 PM
Could you please provide me a sample code....Which can help me out...

Shuja Ali
March 19th, 2009, 02:37 PM
Could you please provide me a sample code....Which can help me out...
As I suggested in your other thread here (http://www.codeguru.com/forum/showthread.php?t=473031), you need to go through the sample that is present on MSDN here (http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.selectedrow.aspx). They have all the code that you are looking for , you just need to tweak it a bit.

Why is it so difficult for you to go through MSDN?

Frank100
March 22nd, 2009, 08:44 AM
Thanks Shuja...