如何绑定列表视图下拉列表进行编辑? [英] How to bind listview dropdownlist for editing?

查看:89
本文介绍了如何绑定列表视图下拉列表进行编辑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

专家,

我正在使用asp.net c Sharp.

在我的edit_event页面中,我正在使用 listview 编辑事件信息.

在我的 edittemplate 文本框中,可以完美地查看.
例如.

Hi Expert,

I am using asp.net c sharp.

In my edit_event page i am editing event information using listview.

In my edittemplate textbox vind perfectly.
eg.

<td>Event Name:</td>
                <td>
                    <asp:TextBox ID="txtEditEventName" runat="server" 
                        Text=''<%# Bind("event_name") %>'' />
                </td>




上面的代码工作正常.

现在我要下拉列表在edittemplate中进行编辑以编辑国家/地区.
我写了以下代码.




above code working fine.

now i want dropdownlist for editing in edittemplate to edit country.
I wrote following code.

<td>Country :</td>
                <td>
                     
                    <asp:DropDownList ID="lstEditCountry" runat="server" 
                              
                            DataTextField="country_name"
                            DataValueField="country_id"
                               SelectedValue=''<%# Bind("country_id") %>''
                              />



它仅显示空白下拉列表.
如何在此下拉列表中显示所有国家/地区.

我有为此目的使用任何事件吗?以及如何?

在此先感谢.......



it shows only blank dropdown.
How to show all countries in this dropdownlist.

is there any event i have to use for this purpose? and how ?

Thanks in advance.......

推荐答案

尝试这个

try this one

 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
 if (e.CommandName == "Edit")
        {
            DropDownList drplist= (DropDownList)GridView1.FooterRow.FindControl("dropdownlist1");

//
//Fill the dataset in ds here
//

drplist.DataSource = ds;
   drplist.DataBind();

}
}


这篇关于如何绑定列表视图下拉列表进行编辑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆