Template fields

G

Guest

I have a Grid view which I attached with dtasource ddSource1. I have a
column in it "Roles" Which I converted as a Template field and create a
dropdown list and attached to another datasource ddSource2
which is from another data table. but it is not working.

<asp:TemplateField HeaderText="Roles" SortExpression="Roles">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#
Eval("Roles") %>'></asp:Label><br />
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="ObjectDataSource22"
DataTextField="RoleName"
DataValueField="RoleName" SelectedValue='<%# Bind("RoleName") %>'>
</asp:DropDownList>
<br />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#
Bind("Roles") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
 
M

Muhammad Naveed Yaseen

Hopefully you are aware that,,,

1) It is ObjectDataSource22 instead of ddlSource2
2) It is in EditItemTemplate which only becomes visible in edit mode.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top