The following code snippet shows how to implement searching in grid view
search.myclass ob1 = new search.myclass();
protected void Page_Load(object sender, EventArgs e) {
} protected void Button2_Click(object sender, EventArgs e) { ob1.property_uid = TextBox1.Text; ob1.property_pass = TextBox2.Text; int x= ob1.insert(); if (x == 1) { Page.ClientScript.RegisterStartupScript(this.GetType(), "msg", "");
TextBox1.Text = ""; TextBox2.Text = ""; } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "msg", ""); TextBox1.Text = " "; TextBox2.Text = " "; } } protected void Button1_Click(object sender, EventArgs e) { bind(); } void bind() { string flag1, flag2; string val; string s = TextBox3.Text; if (TextBox3.Text == "*.*") { flag1 = "full"; flag2 = s; } else { int dotpos, len1, len2; len1 = s.Length; dotpos = s.LastIndexOf("."); if (dotpos == -1) { flag1 = "atomic"; flag2 = s; }
else { len2 = len1 - (2); val = s.Substring(2,len2); flag1 ="xyz"; flag2 = val;
} } ob1.property_flag = flag1; ob1.property_uid = flag2; DataSet ds = ob1.dset(); GridView1.DataSource = ds; GridView1.DataBind();
}
|
No responses found. Be the first to respond and make money from revenue sharing program.
|