DDL fill and select value in gridview

  • Thread starter Thread starter mik
  • Start date Start date
M

mik

Hi, How Can I fill a DDL in a grid view?



<asp:TemplateField HeaderText="AAA" SortExpression="AAA">
<ItemTemplate>
<div align="left">
<asp:DropDownList ID="ddlPorssima"
runat="server" CssClass="Text11" />
</div>
</ItemTemplate>
<HeaderStyle CssClass="Testo8" />
</asp:TemplateField>


and How Can I SelectValue of the DDLs of each row??

Thanks
 
You need to handle the gridview's RowDataBound event. In the event use
e.Item.FindControl("ddlPorssima") to get the reference to the ddl. Once you
have the reference, set the ddl DataSource, call its DataBind method and set
selected item.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 
Back
Top