I have two methods in the same class and would like to find out how to use the first method in the second one.
// first method
public static void RefreshGridView(GridView GridView1)
{
GridView1.DataBind();
}
// second method
public static void AssignDefaultUserNameLetter(Literal categoryID, ObjectDataSource ObjectDataSource1)
{
// declare variable for filter query string
string userFirstLetter = HttpContext.Current.Request.QueryString["az"];
// check for category ID
if (String.IsNullOrEmpty(userFirstLetter))
{
// display default category
userFirstLetter = "%";
}
// display requested category
categoryID.Text = string.Format(" ... ({0})", userFirstLetter);
// specify filter for db search
ObjectDataSource1.SelectParameters["UserName"].DefaultValue = userFirstLetter + "%";
// HERE IS WHAT I DON"T KNOW HOW!
// GET SQUIGLY LINE
RefreshGridView(GridView1);
}
Please note the capital letters above. That is where I am trying to call the first method but getting the red underline. Can some one help please? Thank you.
The method is marked as
staticbutGridView1looks like it is an instance variable.You need to change the method so that
AssignDefaultUserNameLetteris not static or the GridView is fetched some other way such as passed in as a parameter.