如何绑定放置在网格视图中的编辑模板中的下拉列表 [英] how to bind a drop down list placed in edit template in grid view
本文介绍了如何绑定放置在网格视图中的编辑模板中的下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在网格视图的编辑模板中放置了一个下拉列表...
现在在编辑按钮上单击我必须绑定下拉列表...怎么做...
提前感谢
Hi,
I have a drop down list placed in the edit template of a grid view...
now on the edit button click i have to bind the drop down list... how to do that...
thanks in advance
推荐答案
< ; grid>
< edit item =template =>
< dropdownlist id =ddltyperunat =serverdatasourceid =dstype >
DataTextField =TYPEDataValueField =TYPE_IDAppendDataBoundItems =true>
< sqldatasource id =runat =serverconnectionstring =< ; brmode =hold/> ProviderName =System.Data.OracleClientSelectCommand = SelectCommandType = text
/ xml>
<grid>
<edit item="" template="">
<dropdownlist id="ddltype" runat="server" datasourceid="dstype">
DataTextField="TYPE" DataValueField="TYPE_ID" AppendDataBoundItems="true" >
<sqldatasource id=" runat="server" connectionstring="<br" mode="hold" /> ProviderName="System.Data.OracleClient" SelectCommand= SelectCommandType=text
/xml>
您可以通过查找下拉列表在gridview的行创建事件上绑定下拉列表,并且您想在dropdownlis中设置所选值那么你也可以在你的控制中给出selectedvalue ='<%Databinder.Eval(你的专栏名称)%>'。
你可以关注这个链接
http://stackoverflow.com/questions/17289556/set-selected-value-or-text-for-dropdownlist-in-edit-mode-of-gridview-asp -net [ ^ ]
You can bind dropdownlist on row created event of gridview by finding dropdownlist and you wanna set selected value in dropdownlist then you can give selectedvalue='<%Databinder.Eval("ur column name")%>' in ur control also.
You can follow this link
http://stackoverflow.com/questions/17289556/set-selected-value-or-text-for-dropdownlist-in-edit-mode-of-gridview-asp-net[^]
这篇关于如何绑定放置在网格视图中的编辑模板中的下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文