Hi I am overriding the CreateChildControls method, in a separate class, of the gridview to create a custom gridiview. Is there anyway I can access the querystrings from the URL in this class? Thanks!
this method ties the grid to the query string. a more flexible solution would be to create public property and assign the value from the calling page/user control.
this this method an error could occur if the url is not properly formatted.
Code:
public class MyGridView : GridView
{
private int id;
public void SetId(int id)
{
this.id = id;
}
}
then on the page assign the value
Code:
MyGridView grid = new MyGridView();
grid.SetId(int.Parse(Request.QueryString["Id"]));
//or
grid.SetId(1);
//or
grid.SetId(From.SomewhereElse());
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.