Response.Redirect not working from client browser

Posted by Intelmayur under ASP.NET on 3/26/2012 | Points: 10 | Views : 3506 | Status : [Member] | Replies : 5
Hi,

I am using a gridview to display the records in my website. The first column of gridview is button of type "Link" (asp:ButtonField ButtonType="Link" CommandName="GETDETAILS" HeaderText="Name"). On the click of the link of a perticular row I want to redirect the user to the details page. But the response.redirect is not working. I tried all the options like Response.Redirect("A_Details.aspx", true) and Response.Redirect("A_Details.aspx", false) but it doesn't work and stays on the same page and no error is thrown. At the same it redirects perfectly when I open the website from the browser of the server machine where website is hosted. But when I try to redirect from the local machine's browser, nothing happens.

Here is the code for redirection:
protected void gvCases_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName.ToUpper() == "GETDETAILS")
{

int _index = Convert.ToInt32(e.CommandArgument);

//Create session var to be used in the details page.

Session["RecID"] = Convert.ToInt32(gvCases.Rows[_index].Cells[0].Text);

Response.Redirect("A_Details.aspx");

}
}

Any help is highly appreciated.
Thanks in advance.




Responses

Posted by: Sksamantaray on: 3/26/2012 [Member] Silver | Points: 25

Up
0
Down
Do you use any validation control in your page or ajax controls?

Thanks,
Sanjay

Intelmayur, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Intelmayur on: 3/26/2012 [Member] Starter | Points: 25

Up
0
Down
I have not used any Ajax control or validation control. Its a plain asp.net web page.


Thanks,
Mayur

Intelmayur, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 3/26/2012 [Member] Silver | Points: 25

Up
0
Down
Hi,
Debug it once.
I think condition is not satisfied.so its not getting into that code block.

Thanks,
Sanjay

Intelmayur, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Intelmayur on: 3/27/2012 [Member] Starter | Points: 25

Up
0
Down
After digging a lot what I could make out is, the "gvCases_RowCommand" event of gridview is not getting raised on some occasions..I am clueless as to why its happening..

Thanks,
Mayur


Intelmayur, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sabarimahesh on: 3/28/2012 [Member] Bronze | Points: 25

Up
0
Down
Intelmayur
You Tried To Write in gvCases_RowCommand

You not Written

Check it

Life is a Race
Thanks & Regards
By
Sabari Mahesh P M

Intelmayur, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response