Reputation:
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!
Upvotes: 0
Views: 1304
Reputation: 9752
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;
}
}
Upvotes: 2