Frage

I have a problem with update panel which contains gridview (dynamically generated). Every row in gridview contains checbox, name of person and surname of person. When user click on close button then every value (name) of selected row is saved in cookie (using jquery and asp.net-hidden value). That is working all right.

Problem appears here: I also have possibility to search after name or surname of persons, becuase there are a lot of persons and that should help user to quickly find a right person. Let say that I have this data:

Checbox1 John Doe

Checkox2 Michael Clark

Checbox1 (John Doe) is already selected.

So when I typed Clark in Surname textbox and click button "Search" gridview is generated again and there is one row (Michael Clark). When user select checbox of Michael Clark and click close button than cookie has only one value (Michael Clark, John Doe is logically missing).

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <asp:Panel ID="Panel1" runat="server" DefaultButton="isciPodjetja">
            <asp:TextBox ID="namePerson" runat="server" />
            <asp:TextBox ID="surnamePerson" runat="server" />
            <asp:Button ID="Searchperson" runat="server" Text="Search" OnClick="Serachperson_Click" />
        </asp:Panel>
        <p />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
            <Columns>
                <asp:TemplateField HeaderText="SelectALL">
                    <HeaderTemplate>
                        <asp:CheckBox ID="chkBxHeader" runat="server" onclick="javascript:SelectAllCheckboxes1(this);" />
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="chkSelected" runat="server" OnCheckedChanged="chkSelected_CheckedChanged"/>
                    </ItemTemplate>                   
                </asp:TemplateField>
                <asp:BoundField DataField="NAME" HeaderText="Name of person"></asp:BoundField>
                <asp:BoundField DataField="SURNAME" HeaderText="Surname of person" </asp:BoundField>
            </Columns>
        </asp:GridView>
    </ContentTemplate>
</asp:UpdatePanel>

Any Idea how can I implement that searching more easily? I tried with adding OnCheckedChanged to checbox, but autopostback does not work fine (when I clicked on checbox it is checked for a second, then is unchecked again).

Best solution for me would be, that when user click on search button than just hover appear on a correct row. Is it possible?

War es hilfreich?

Lösung 2

I solved my problem. I used javascript quicksearch plugin from https://github.com/riklomas/quicksearch.

Andere Tipps

You have to develop two function in javascript begin request and end request.You have to write your javascript or jquery function in onbeginrequest() and onendrequest(), then only it will be fired. Please check it.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top