开发者

Bind the asp control while typing the text in Text box

开发者 https://www.devze.com 2023-03-09 10:50 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消