c# - GridView 中 DropDownList 中的 Eval()

标签 c# asp.net .net drop-down-menu

如何在 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/

相关文章:

c# - 添加双 httpHeaders

.net - 获取 Windows 主题?

c# - 在多线程环境中的 SQL Server 中执行 INSERT 后获取 Id?

.net - DataGrid 控件已禁用

c# - 错误-无法将类型 'System.Byte[]' 的对象强制转换为类型 'System.IConvertible'

c# - 集中应用程序之间的身份验证代码

c# - 设置 DataGridComboBoxColumn 的 ElementStyle 会破坏预期的行为

java - .NET 中的 POST 多部分/混合

c# - 具有派生类型的 XML 序列化

c# - 寻找在调试器中获取对象实例的方法的工具?