using hyperlink column in gridview and getting 'does not exist in the current context' error in page_load

StackOverflow https://stackoverflow.com/questions/664465

Question

HI, I have a HyperLink column in a gridview that when clicked should navigate the user to another page. I pass parameters to the page using a querystring. I am implemeting this action in the grid's onrowdatabound event. here is the code:

            HyperLink btnDetails = (HyperLink)ea.Row.FindControl("btnDetails");
            btnDetails.NavigateUrl = "ManageFlaggedSecurities.aspx?portfolioID=" + obPortfolioId.ToString() + "&testID=" + obTstId.ToString();

I can set a breakpoint in my page_load event of the ManageFlaggedSecurities page but when I want to check the values of some string parameters i set I get 'does not exist in the current context' on the variables. I even tried something simple like

string strTest = "testing";

and got the error. What am I doing wrong?

Mike

Was it helpful?

Solution

It sounds like you are trying to access variables declared inside the event handler while having a break point on Page_Load, hence having them out of scope, or trying to access variables that were declared in the caller up the stack.

Show some code...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top