DataGrid DataBind

  • Thread starter Thread starter Jim Heavey
  • Start date Start date
J

Jim Heavey

I have a datagrid which is bound to data Table A. When I
edit a row, I want 2 columns to show a DropDownList with
on of those columns bound to Table B and the other bound
to Table C.

Can I do that?
 
Sure u can.

Make two column as template and Add DropDownList as usual and bind it to database.

Below is tag for Datagrid with two Columns having DropDownList.

<asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 127px; POSITION: absolute; TOP: 44px" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:DropDownList id=DropDownList1 runat="server" DataSource="<%# UrDataSource1 %>" DataTextField="UrDataTextField2" DataValueField="UrDataValueField2">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:DropDownList id="DropDownList2" runat="server" DataSource="<%# UrDataSource2 %>" DataTextField="UrDataTextField2" DataValueField="UrDataValueField2"></asp:DropDownList>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>

Hope this helps

Thanks,

sswalia
MCSD, MCAD, OCA
 
Back
Top