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

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Using jquery append to add option values into a select element not working -

javascript - Restarting Supervisor and effect on FlaskSocketIO -