通过文本框更改文本动态绑定gridview [英] bind dynamically gridview by textbox change text
本文介绍了通过文本框更改文本动态绑定gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个textboox和一个gridview。我想通过传递textbox文本来动态地绑定gridview,而不需要花费更多时间,
i have one textboox and one gridview. i want to do bind gridview dynimically by passing text of textbox,without taking more time ,
推荐答案
你好专业
有TextChanged事件文本框控件可以帮助你做到这一点...
喜欢:
hello professional
there is TextChanged event of text box control that can help you do this...
like:
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
try
{
//here you get your value
String Value= TextBox1.Text.ToString();
//here you can call a method where you already binded your grid
BindGrid(Value);
}
catch(Exception ex)
{
//show your Exception
}
}
更多去扔这个...
http://msdn.microsoft.com/en-us/library/system.web.ui .webcontrols.textbox.textchanged.aspx [ ^ ]
乐于助人!!!
for more go throw this...
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.textchanged.aspx[^]
Happy to help!!!
i已创建
i have created
protected void txtSearch_TextChanged(object sender, EventArgs e)
{
GEtUsernamendRoleofUser user=new GEtUsernamendRoleofUser();
SearchEmployeeByNameInput userinput=new SearchEmployeeByNameInput();
SearchEmployeeByNameOutput useroutput = new SearchEmployeeByNameOutput();
userinput.First_Name = txtSearch.Text;
useroutput = user.Execute(userinput);
gridviewbatch.DataSource = useroutput.DtEmployeeSearch;
gridviewbatch.DataBind();
for (int i = 0; i < gridviewbatch.Rows.Count; i++)
{
String lbl = ((Label)gridviewbatch.Rows[i].FindControl("lblrole")).Text;
Label role = (Label)gridviewbatch.Rows[i].FindControl("UserRole");
if (lbl.Equals("1"))
{
role.Text = "Admin";
}
else if (lbl.Equals("2"))
{
role.Text = "Employee";
}
else if (lbl.Equals("3"))
{
role.Text = "Parent";
}
else if (lbl.Equals("4"))
{
role.Text = "Student";
}
}
if (useroutput.NoOfRows == 0)
{
lblsubjectmassageshow.Text = "No user found!";
lblsubjectmassageshow.Visible = true;
}
else
{
lblsubjectmassageshow.Visible = false;
}
}
但我想在改变时创建像google一样文本框中的文字比页面刷新速度快。
but i want to create like google when change text in textbox than page refreshing is very fast .
这篇关于通过文本框更改文本动态绑定gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文