Hi everyone , i try to validate a [string ID] when user input it in a textBox(C#)for searching datarows in database , but it does not send a message "False Input" if i input a wrong string ID which is different from database .
protected void button_search(object sender, EventArgs e)
{
string str = TextBox1.Text;
Dataset ds = Class.Search(str);
for(i=0; i<ds.Tables[0].Rows.Count; i++)
{
if(str == ds.Tables[0].Rows[i][0].ToString())// column[0] is the "string ID" //Column in database
{
GridView1.DataSource = ds;
GridView1.DataBind();
GridView1.Visible = true;
Label1.Visible = false;
}
else
{
Label1.Text = "False Input";
Label1.Visible = true;
GridView1.Visible = false;
}
}
}