Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 文本框文本的GridView更新已更改_C#_Asp.net_Gridview_Webforms - Fatal编程技术网

C# 文本框文本的GridView更新已更改

C# 文本框文本的GridView更新已更改,c#,asp.net,gridview,webforms,C#,Asp.net,Gridview,Webforms,我想为GridView数据创建实时搜索,因此我尝试了以下代码: 我在aspx文件中有这个: <asp:ScriptManager ID="DateManager" runat="server" /> <asp:UpdatePanel ID="setDate" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true"> <C

我想为
GridView
数据创建实时搜索,因此我尝试了以下代码:

我在
aspx
文件中有这个:

        <asp:ScriptManager ID="DateManager" runat="server" />
            <asp:UpdatePanel ID="setDate" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
                <ContentTemplate>
                <asp:TextBox ID="gro" runat="server" Width="73px" />&nbsp;
                <asp:TextBox ID="job" runat="server" Width="94px" />&nbsp;
                <asp:TextBox ID="username" runat="server" Width="98px" />&nbsp;
                <asp:TextBox ID="lname" runat="server" Width="123px" />&nbsp;
                <asp:TextBox ID="fname" runat="server" Width="78px" 
                        ontextchanged="fname_TextChanged" AutoPostBack="True" />
            <asp:GridView ID="res" runat="server" AutoGenerateColumns="False" 
                CellPadding="4" ForeColor="#333333" GridLines="None" Width="600px" 
                        AllowPaging="True" DataKeyNames="id">
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                <asp:CommandField SelectText="selectIt" ShowSelectButton="True" />
                    <asp:BoundField DataField="fname" HeaderText="First Name" />

                </Columns>
                <EditRowStyle BackColor="#2461BF" />
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#EFF3FB" />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                <SortedAscendingCellStyle BackColor="#F5F7FB" />
                <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                <SortedDescendingCellStyle BackColor="#E9EBEF" />
                <SortedDescendingHeaderStyle BackColor="#4870BE" />
            </asp:GridView>

            </ContentTemplate>
                <Triggers>
                   <asp:AsyncPostBackTrigger ControlID="fname" EventName="TextChanged"  />
                </Triggers>
            </asp:UpdatePanel>
当我输入
fname
时,
GridView
不会改变,但当我在
GridView
中单击selectIt时,它会显示搜索结果。

试试这个

if (re != null)
            {

                res.DataSource = re;
                res.DataBind();
            }
试试这个

if (re != null)
            {

                res.DataSource = re;
                res.DataBind();
            }
设置网格视图的属性
EnableViewState=“false”


<asp:GridView ID="res" runat="server" EnableViewState="False" >