如何在 GridView
内的 DropDownList
中执行 Eval()
?
我试了下面的代码,还是不对:
<asp:TemplateField HeaderText="Prioridade">
<ItemTemplate>
<asp:DropDownList ID="ddlPrioridade" runat="server"
SelectedValue='<%# Eval("Prioridade") %>'>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
最佳答案
试试这个
<asp:DropDownList ID="ddlPrioridade" runat="server" AppendDataBoundItems="true" DataSourceID="datasource" DataTextField="key" DataValueField="data" AutoPostBack="True" SelectedValue='<%# Eval("Prioridade") %>'>
也看看这个DropDownList inside a GridView (or DataGrid) .可能对你有帮助
关于c# - GridView 中 DropDownList 中的 Eval(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7850004/