0

I'm able to pass the parameter in the URL, however, i'm unsure of how to grab that ID on the next page.

I'm using a GridView to pass the parameter onclick, below is the code i'm using.

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        e.Row.Attributes["onmouseover"] = "this.style.color='Black';this.style.cursor='hand';";
        e.Row.Attributes["onmouseout"] = "this.style.color='Black';";
        e.Row.Attributes["onclick"] = "window.navigate('NavigatedPage.aspx?id=" + e.Row.Cells[0].Text.ToString().Trim() + "')";
    }
}

i need what's after the id=

Thanks!

2 Answers 2

2

I could be mistaken from what your trying to ask, but I think your trying to accertain how to access the query string parameter on a new page. If this is the case then it's

Request.QueryString["name"]

But remember to check if its got some contents first

What I like to do is

string GetQueryStringVarible(string name, string defaultValue)
{
  if(!string.IsNullOrEmpty(Request.QueryString[name])
  { 
    return Request.QueryString[name];
  } 
  else 
  {
    return defaultValue;
  }
}
Sign up to request clarification or add additional context in comments.

Comments

0

On the next page, do:

 string id =Request.QueryString["id"];

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.