Custom Filter issue

4 replies. Last post: December 9, 2010 11:49 AM by Frank Bruce
Tags :
  • New Discussion
  • New Question
  • New Product Feedback
Frank BruceMember

When Ioading the page,I want to apply The custom Filter in the webgrid2,But it does not work.

(However,the gridview can apply The custom Filter  )
Could you show me a demo about custom Filter ?
Anyone can help me ?thanks

Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Pop1.aspx.cs" Inherits="Pop1" %>

<%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISWebGrid" %>
<%@ Register Assembly="ISNet.WebUI.WebDesktop" Namespace="ISNet.WebUI.WebDesktop"
    TagPrefix="ISWebDesktop" %>
<%@ Register Assembly="ISNet.WebUI.WebInput" Namespace="ISNet.WebUI.WebControls"
    TagPrefix="ISWebInput" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <table width="375px">
        <tr>
            <td width="45px">
                关键字
            </td>
            <td>
                <ISWebInput:WebInput Width="100px" ID="WebInput1" runat="server">
                </ISWebInput:WebInput>
                <asp:TextBox ID="TextBox1" runat="server" Text="大"></asp:TextBox>
            </td>
            <td>
                <ISWebDesktop:WebButton ID="WebButton2" runat="server" Height="20px" Text="查找" Width="50px"
                    AutoPostback="true" PostBackMode="FlyPostBack">
                </ISWebDesktop:WebButton>
                <asp:Button ID="Button1" runat="server" OnClick="Button1_Click1" Text="Button" />
            </td>
        </tr>
        <tr>
            <td colspan="3">
                <ISWebGrid:WebGrid ID="WebGrid2" runat="server" Height="315px" UseDefaultStyle="True"
                    Width="371px" DataSourceID="Sqltb_stock" DefaultStyleMode="Elegant">
                    <LayoutSettings AlternatingColors="false" AllowContextMenu="False">
                        <ClientSideEvents OnCellDblClick="DbclickAutoFill()" />
                        <SelectedRowStyle BackColor="#FFBD69" />
                    </LayoutSettings>
                    <RootTable>
                        <Columns>
                            <ISWebGrid:WebGridColumn Caption="tradecode" DataMember="tradecode" Name="tradecode"
                                Width="100px">
                            </ISWebGrid:WebGridColumn>
                            <ISWebGrid:WebGridColumn Caption="fullname" DataMember="fullname" Name="fullname"
                                Width="100px">
                            </ISWebGrid:WebGridColumn>
                            <ISWebGrid:WebGridColumn Caption="unit" DataMember="unit" Name="unit" Width="100px">
                            </ISWebGrid:WebGridColumn>
                            <ISWebGrid:WebGridColumn Caption="qty" DataMember="qty" DataType="System.Double"
                                Name="qty" Width="100px">
                            </ISWebGrid:WebGridColumn>
                            <ISWebGrid:WebGridColumn Caption="averageprice" DataMember="averageprice" DataType="System.Double"
                                Name="averageprice" Width="100px">
                            </ISWebGrid:WebGridColumn>
                        </Columns>
                    </RootTable>
                </ISWebGrid:WebGrid>
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="Sqltb_stock">
                    <Columns>
                        <asp:BoundField DataField="tradecode" HeaderText="tradecode" SortExpression="tradecode" />
                        <asp:BoundField DataField="fullname" HeaderText="fullname" SortExpression="fullname" />
                        <asp:BoundField DataField="unit" HeaderText="unit" SortExpression="unit" />
                        <asp:BoundField DataField="qty" HeaderText="qty" SortExpression="qty" />
                        <asp:BoundField DataField="averageprice" HeaderText="averageprice" SortExpression="averageprice" />
                    </Columns>
                </asp:GridView>
            </td>
        </tr>
    </table>
    <asp:SqlDataSource ID="Sqltb_stock" runat="server" FilterExpression="fullname Like '%{0}%'"
        ConnectionString="<%$ ConnectionStrings:db_CMSConnectionString %>" SelectCommand="SELECT [tradecode], [fullname], [unit], [qty], [averageprice] FROM [tb_stock]">
        <FilterParameters>
            <asp:ControlParameter ControlID="TextBox1" ConvertEmptyStringToNull="False" Name="fullname"
                PropertyName="Text" />
        </FilterParameters>
    </asp:SqlDataSource>
    </form>
</body>
</html>
1 attachment
All times are GMT -5. The time now is 5:53 PM.
Previous Next