如何动态填充listview编辑模板listitem值(asp)?

时间:2018-06-15 12:51:15

标签: html asp.net listview

我希望能够从web.config文件中动态填充下面的3个列表项,如何在我的c#代码中执行此操作,而不是在html代码中对它们进行硬编码?

<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?
        }

}

0 个答案:

没有答案