Hi,
I got a question when about the databinding for GridView. I am using the data source configuration wizard to bind a sqlsource1 from my database. However,
I need way to find if there are data return from my database, if yes, I will show the data, or, If no, I want to show a message says that "no record has been found". I am using a search buttom to trigger the databinding procedure.
here is part of my code:
protected void ButtonSearch_Click(object sender, EventArgs e)
{
if (GridView1.Rows.Count > 0)
{
Label1.Text = "3. Please select an address below";
}
else
{
Label1.Text = "No records! Please enter a valid site address.";
}
However, I noticed that the databind alway happens after the buttom click event, that means, the GridView1.Row.Count always return 0.
Please give me some suggest.
Thanks for your reply!