locked
Sort grid view showing checked items first RRS feed

  • Question

  • User-718146471 posted

    Hello folks. I am doing my data provisioning in code behind. Is there some way or method be it JQuery or otherwise that will let me load my selections and then from there put the checked boxes first? Just to clarify this is a standard gridview with template fields. Here's the control code:

                                <asp:GridView ID="gvDevs" AllowSorting="true" runat="server"
                                    AutoGenerateColumns="False" Width="100%">
    
                                    <Columns>
                                        <asp:TemplateField>
                                            <ItemTemplate>
                                                <asp:CheckBox ID="chkIt" runat="server" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Display Name">
                                            <ItemTemplate>
                                                <asp:Label ID="lblADName" runat="server" Text='<%# Eval("ADName") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Account Name">
                                            <ItemTemplate>
                                                <asp:Label ID="lblADSAN" runat="server" Text='<%# Eval("ADSan") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                </asp:GridView>
    
    Wednesday, January 3, 2018 1:59 PM

Answers

  • User475983607 posted

    Can't you simply add ORDER BY to the query that populates the gridview data?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 3, 2018 2:35 PM

All replies

  • User475983607 posted

    Can't you simply add ORDER BY to the query that populates the gridview data?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 3, 2018 2:35 PM
  • User-718146471 posted

    I suppose I could do that. I'll let you know.

    Wednesday, January 3, 2018 2:59 PM