views:

275

answers:

0

I'm trying to do a search that you type in some letters and it returns list of results and you can type more for accuracy. The next code is in modalpopupextender.

<asp:UpdatePanel runat="server" ID="upnlPatientSearchModal" >
        <ContentTemplate>
    <div class="popupheader" align="left" width="300">
        <asp:TextBox ID="txtFieldOne" runat="server" TabIndex="1" />
        <asp:TextBox ID="txtFieldTwo" runat="server" TabIndex="2" />
        <asp:TextBox ID="txtFieldThree" runat="server" TabIndex="3"/>
        <asp:ImageButton runat="server" ID="btnSearch" AlternateText="Search" ImageUrl="~/someimg.gif" OnClick="RegularSearch" />
    </div>
    <div>
        <div>
            <asp:UpdatePanel runat="server" ID="uppnlTableOnly" UpdateMode="Conditional" >
                <ContentTemplate>
                <input runat="server" id="btnQuickSearch" type="button" style="visibility:hidden;display:none" />
            <table>Here goes search result</table>
            </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </div>
    </ContentTemplate>
    </asp:UpdatePanel>

So in PreRender I add some more attributes to fire right events.

txtFieldOne.Attributes.Add("onkeyup", "forceCallback(this,'" + btnQuickSearch.ClientID + "',3,400)");
        txtFieldTwo.Attributes.Add("onkeyup", "forceCallback(this,'" + btnQuickSearch.ClientID + "',3,400)");
        txtFieldThree.Attributes.Add("onkeyup", "forceCallback(this,'" + btnQuickSearch.ClientID + "',3,400)");

forceCallback just fires on the third letter to btnQuickSearch to click and search for items.

Now My problem is, that all is good, but focus gets to stand where it was and nothing happens anymore, until I click with a mouse to somewhere in the textboxes. Is is because I have too many update panels in my app or is there someway to make it better?