Html 如何动态填充listview编辑模板listitem值(asp)?
我希望能够从web.config文件中动态填充下面的3个列表项,如何在我的c#代码隐藏中实现这一点,而不是将它们硬编码到html代码中Html 如何动态填充listview编辑模板listitem值(asp)?,html,asp.net,listview,Html,Asp.net,Listview,我希望能够从web.config文件中动态填充下面的3个列表项,如何在我的c#代码隐藏中实现这一点,而不是将它们硬编码到html代码中 <EditItemTemplate> <tr style=""> <td> <asp:DropDownList ID="component" runat="server" AppendDataBoundItems="true" Text='<%# Bind
<EditItemTemplate>
<tr style="">
<td>
<asp:DropDownList ID="component" runat="server" AppendDataBoundItems="true" Text='<%# Bind("component") %>' >
<asp:ListItem>Choose a component</asp:ListItem>
<asp:ListItem>Component1</asp:ListItem>
<asp:ListItem>Component2</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</EditItemTemplate>
protected void lvwOutput_ItemCommand(object sender, ListViewCommandEventArgs e)
{
string stop = "here";
if (e.CommandName == "Edit")
{
// what can I do here?
}
}
选择一个组件
组件1
组件2
受保护的void lvwOutput_ItemCommand(对象发送方,ListViewCommandEventArgs e)
{
字符串stop=“here”;
如果(例如,CommandName==“编辑”)
{
//我能在这里做什么?
}
}
物品计数是否固定?否,listitem计数不固定。我希望能够在web.config中添加和减去项目。里面可能有50个项目,可能有5个项目。我可以阅读web.config,但我不知道如何填充编辑模板,谷歌也没有任何帮助?你使用的是GridView吗?看看我使用的listview链接,它看起来与我使用的非常相似。我没有看到程序员有一个列表以编程方式填充编辑模板?