Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.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
Asp.net Dropdownlist On SelectedIndexChanged未触发_Asp.net - Fatal编程技术网

Asp.net Dropdownlist On SelectedIndexChanged未触发

Asp.net Dropdownlist On SelectedIndexChanged未触发,asp.net,Asp.net,我有一个datagrid,在一列中有下拉列表: <asp:TemplateColumn HeaderText=""> <ItemStyle HorizontalAlign="Center"></ItemStyle> <ItemTemplate> <asp:Label runat="server" ID="lblRes

我有一个datagrid,在一列中有下拉列表:

            <asp:TemplateColumn HeaderText="">
                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblResultId" Visible="false" text='<%# DataBinder.Eval(Container, "DataItem.CurrentId", "{0:g}") %>'/>
                    <asp:DropDownList ID="ddlCurrentValue" DataTextField="Description" DataValueField="Id" Runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlCurrentValue_OnSelectedIndexChanged">
                        <asp:ListItem Text="" Value="0" Selected="True"></asp:ListItem>
                        <asp:ListItem Text="1" Value="1">1</asp:ListItem>
                        <asp:ListItem Text="2" Value="2">2</asp:ListItem>
                        <asp:ListItem Text="3" Value="3">3</asp:ListItem>
                        <asp:ListItem Text="4" Value="4">4</asp:ListItem>
                        <asp:ListItem Text="5" Value="5">5</asp:ListItem>
                        <asp:ListItem Text="6" Value="6">6</asp:ListItem>
                        <asp:ListItem Text="7" Value="7">7</asp:ListItem>
                        <asp:ListItem Text="8" Value="8">8</asp:ListItem>
                    </asp:DropDownList>
                </ItemTemplate>
            </asp:TemplateColumn>

1.
2.
3.
4.
5.
6.
7.
8.
我根据从ItemDataBound上的数据库中获取的值,为每个下拉列表设置所选的值

现在,如果用户更改其中一个下拉列表的值,我想保存该下拉列表中的值

我的id是,我在lblResultId中有数据库id,并使用它通过linq查询将下拉列表中的selectedvalue保存到数据库中。然而,我已经被“onselectedindexchanged”卡住了,因为DropDownList没有启动。。。。。
有没有关于如何处理或如何以不同方式执行此操作的建议?

网格视图是否放置在“更新”面板中?。为获得更好的解决方案,请同时显示您的下拉列表,选择更改事件。仅供参考
1
无需像这样放置
1
这只起作用。如果文本和值不同,则可以使用文本和值进行区分。