Wizilling
asked on
how to repopulate a Gridveiw when using parameters
Hi,
in my asp.net project i have placed a text box, a button, and a gridview.
I will enter some text on the text box and click the button. The button should run the query " select * from table where value=something" and populate the grid view. I dont know how to do this.
Any examples or links to read on will be very helpful ?
i can get the grid to display All of the data.. but i want after the page loads, i insert my own filter and re-populate the grid...
I am using VB Studion 2005 standart, asp.net website project and vb language.
in my asp.net project i have placed a text box, a button, and a gridview.
I will enter some text on the text box and click the button. The button should run the query " select * from table where value=something" and populate the grid view. I dont know how to do this.
Any examples or links to read on will be very helpful ?
i can get the grid to display All of the data.. but i want after the page loads, i insert my own filter and re-populate the grid...
I am using VB Studion 2005 standart, asp.net website project and vb language.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
LoadData("Select * from customers");
}
}
private DataSet LoadData(string strQuery)
{
DataSet objDataSet=new DataSet();
// Use the SQLCommand to fill the data set
return objDataSet;
}
protected void Button1_Click(object sender, EventArgs e)
{
LoadData("Select * from customers where customerName='" + txtName + "'");
}