gridview - C# - How to populate a DropDownList in EditItemTemplate -


here, have dropdownlist in edititemtemplate:

<asp:templatefield headertext="requestedby" sortexpression="requestedby">                         <edititemtemplate>                             <asp:dropdownlist id="requserddl" runat="server" appenddatabounditems ="true" datasourceid="requsersdatas" datatextfield="name" datavaluefield="name" selectedvalue='<%# bind("name") %>' >                             </asp:dropdownlist>                             <asp:sqldatasource id="requsersdatas" runat="server" connectionstring="<%$ connectionstrings:itassetmgmtconnectionstring1 %>" selectcommand="select firstname + lastname name users"></asp:sqldatasource>                         </edititemtemplate>                         <itemtemplate>                             <asp:label id="label7" runat="server" text='<%# eval("requestedby") %>'></asp:label>                         </itemtemplate>                     </asp:templatefield> 

however, keep getting error:

databinding: 'system.data.datarowview' not contain property name 'name'.

is there way remedy this?

use eval instead of bind. bind read and/or write, eval read-only.

edit: eval/bind error not from requsersdatas datasource. trying column named 'name' on data source of gridview has templatefield showed. need make sure other data source has column named 'name'.


Comments