且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何绑定放置在网格视图中的编辑模板中的下拉列表

更新时间:2023-02-24 22:07:01

&lt ; grid>

< edit item =template =>

< dropdownlist id =ddltyperunat =serverdatasourceid =dstype >

DataTextField =TYPEDataValueField =TYPE_IDAppendDataBoundItems =true>

< sqldatasource id =runat =serverconnectionstring =&lt ; 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://***.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://***.com/questions/17289556/set-selected-value-or-text-for-dropdownlist-in-edit-mode-of-gridview-asp-net[^]