过滤Gridview

时间:2017-03-21 23:00:10

标签: c# gridview twitter-bootstrap-3 footable

当我过滤Gridview时,我失去了Footable功能。 奇怪的行为,如果我点击过滤器按钮,按品牌过滤并选择Pireli选项,然后点击更新按钮。

我丢失了Footable功能,但如果我再次单击“更新”按钮,将过滤器保留为Pireli,则Footable功能将返回!!!!!

看到相信你是否导航到以下网址www.tyrescanner.net

输入注册WR08SZE 输入邮政编码KA227PR

抱歉在这里跳来跳去。

如果单击文件管理器品牌选项并选择Pireli,Gridview将丢失Footable功能,但如果再次单击更新按钮,则Footable功能将返回!!!!!!!!

<asp:Content ID="Content1" ContentPlaceHolderID="Header" runat="server">

<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery-footable/0.1.0/css/footable.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-footable/0.1.0/js/footable.min.js"></script>




<%--Resizing Gridview--%>
<script>
    $(function () {
        AttachjQueryFootableToTable();
    });

    function AttachjQueryFootableToTable() {
        $('[id*=GridView1]').footable();
    }
</script>

<script>
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    prm.add_endRequest(function () {
        AttachjQueryFootableToTable();
    });
</script>

    

<div class="row">
    <div class="col-md-8 col-md-pull-0 ">
        <asp:Label ID="lblRegText" runat="server" Text="Tyre Size:  " Style="font-weight: 700; font-size: x-large" Visible="True"></asp:Label>
        <asp:Label ID="lbltyresize" runat="server" Style="font-weight: 700; font-size: x-large" Visible="True"></asp:Label>
        <a href="http://tyrescanner.net/pages/edit-tyre-size.aspx">
            <asp:Label ID="lblEdit" runat="server" Text=" Edit" Style="font-size: large" Visible="True"></asp:Label>
        </a>
    </div>
</div>
<br />

<div class="row">
    <div class="col-sm-4 col-md-4">
        <div class="container">
            <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo"><span class="glyphicon glyphicon-filter">Filter</span></button>
            <div id="demo" class="collapse">
                <div class="row">
                    <div class="col-md-2 col-sm-2" style="width: 130px">
                        <h5><strong>Brand</strong></h5>
                        <asp:DropDownList ID="SRDDLBrand" runat="server" DataSourceID="SqlDataSourceBrand" DataTextField="TyreBrands" DataValueField="TyreBrands" Height="35px" Width="105px" AppendDataBoundItems="True">
                            <asp:ListItem Text="Select All" Value=" " />
                        </asp:DropDownList>
                    </div>

                    <div class="col-md-2 col-sm-2" style="width: 130px">
                        <h5><strong>Season</strong></h5>
                        <asp:DropDownList ID="SRDDLTyreType" runat="server" DataSourceID="SqlDataSourceTyreType" DataTextField="TyreType" DataValueField="TyreType" Height="35px" Width="105px" AppendDataBoundItems="True">
                            <asp:ListItem Text="Select All" Value=" " />
                        </asp:DropDownList>
                    </div>

                    <div class="col-md-2 col-sm-2" style="width: 130px">
                        <h5><strong>Fuel Efficiency</strong></h5>
                        <asp:DropDownList ID="SRDDLFuelCat" runat="server" DataSourceID="SqlDataSourceFuelCategory" DataTextField="TyreCategory" DataValueField="TyreCategory" Height="35px" Width="105px" AppendDataBoundItems="True">
                            <asp:ListItem Text="Select All" Value=" " />
                        </asp:DropDownList>
                    </div>

                    <div class="col-md-2 col-sm-2" style="width: 130px">
                        <h5><strong>Wet Grip</strong></h5>
                        <asp:DropDownList ID="SRDDLWetGrip" runat="server" DataSourceID="SqlDataSourceWetGrip" DataTextField="TyreCategory" DataValueField="TyreCategory" Height="35px" Width="105px" AppendDataBoundItems="True">
                            <asp:ListItem Text="Select All" Value=" " />
                        </asp:DropDownList>
                    </div>
                    <br />
                    <p></p>

                    <div class="col-md-2 col-sm-2">
                        <asp:Button ID="bntFilter" runat="server" OnClick="bntFIlter_Click" Text="Update Results" CssClass="btn Jumbt btn-custom" Style="color: white" role="button" Height="44px" />
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<br />


<asp:UpdatePanel UpdateMode="Conditional" ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true">
    <ContentTemplate>
        <asp:GridView ID="GridView1" CssClass="footable" runat="server" AutoGenerateColumns="False" Style="max-width: 130%" AutoPostback="Flash" DataKeyNames="ProductID,GarageID" DataSourceID="SqlDataSourceGridViewSearchResults"
            EmptyDataText="Sorry we don’t have that tyre, please email us your requirements and we will add it to our Search engine – service@tyrescanner.net"
            OnSelectedIndexChanging="GridView1_SelectedIndexChanging" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" OnRowCommand="GridView1_RowCommand" OnRowDataBound="GridView1_RowDataBound" OnRowCreated="GridView1_RowCreated">
            <Columns>
                <%--  0--%>
                <asp:BoundField DataField="ProductID" HeaderText="ProductID" Visible="false" />
                <%--1--%>
                <asp:BoundField DataField="GarageID" HeaderText="GarageID" Visible="false" />
                <%-- 2--%>
                <asp:BoundField DataField="GarageTown" HeaderText="Garage Location"></asp:BoundField>

                <%-- 3--%>
                <asp:TemplateField HeaderText="Tyre Model">
                    <ItemTemplate>
                        <asp:Label ID="lblBrand" runat="server" Text='<%#Eval("Brand")+ " " + Eval("TyreModel")%>'></asp:Label>
                        <br />
                        <asp:Label ID="Label1" runat="server" Text="£" Height="16px" Width="4px" Font-Bold="True"></asp:Label>
                        <asp:Label ID="lblCurrency" runat="server" Font-Bold="True" Text='<%#Eval("ProductUnitSalePrice")%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <%--  4--%>
                <asp:BoundField DataField="TyreType" HeaderText="Tyre Type" />
                <%--  5  --%>
                <asp:TemplateField HeaderText="Noise Level">
                    <ItemTemplate>
                        <asp:Label ID="lblNoiseEmission" runat="server" Text='<%#Eval("NoiseEmission")+ "dB"%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:BoundField DataField="FuelEfficiencyCategory" HeaderText="Fuel Efficiency" />
                <%--  6   --%>
                <asp:BoundField DataField="WetGrip" HeaderText="Wet Grip" />
                <%--  7   --%>
                <asp:TemplateField HeaderText="Select Quantity">
                    <ItemTemplate>
                        <asp:DropDownList ID="txtQuantity" runat="server" OnSelectedIndexChanged="txtQuantity_SelectedIndexChanged"
                            AutoPostBack="true" Width="55px" Height="32px" DataFormatString="{0:£ 0.0}" ForeColor="Black">
                            <asp:ListItem Text="0" Value=" " />
                            <asp:ListItem>1</asp:ListItem>
                            <asp:ListItem>2</asp:ListItem>
                            <asp:ListItem>3</asp:ListItem>
                            <asp:ListItem>4</asp:ListItem>
                            <asp:ListItem>5</asp:ListItem>
                        </asp:DropDownList>
                        <asp:Label ID="Errorlabel" runat="server" Text=""></asp:Label><p></p>
                        <asp:Label ID="LabelTotalPoundSign" runat="server" Font-Bold="true" Text="Total £" Height="16px" Width="4px"></asp:Label>&nbsp;
                              <asp:Label ID="lblTotal" runat="server" Font-Bold="true" Text="0.00" Width="30px"></asp:Label>&nbsp;
                        <asp:LinkButton runat="server" OnClick="btnOrder_Click" CommandName="Select" class="btn btn-custom btn-sm" Style="color: white">Order &raquo;</asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </ContentTemplate>
</asp:UpdatePanel>

0 个答案:

没有答案