Bind the asp control while typing the text in Text box
I have a text box and a repeater control. I need to bind the data to repeater control when a user is entering the text in text box. This should happen without clicking on the enter key or mouse click.
Repeater should be bind开发者_JS百科ed with the names starts with the given string in the text box
anybody have an idea?
I am assuming that what you want is to enter the same value from the textbox on to a repeater column. You can use the onchange event of the textbox to call javascript and update your repeater.
ASPX
<asp:ScriptManager ID="ScriptManager1" runat="server" /> <div id="Container"> <asp:UpdatePanel runat="server" ID="UpdatePanel1"
OnLoad="UpdatePanel1_Load"> <ContentTemplate>
<asp:Repeater runat="server" ID="rpt"></asp:Repeater> </ContentTemplate> </asp:UpdatePanel>
<input type="text" id="Container" onkeyup='update(document.getElementById("Container").value)'>
JS
function update(args)
{
__doPostBack('UpdatePanel1', args);
}
C#
protected void UpdatePanel1_Load(object sender, EventArgs e)
{
//bind reapeter
}
Got it.. This http://www.dotnettutorials.com/tutorials/ajax/ajax-search-csharp.aspx helps me to get what exactly I want with minor changes.
精彩评论