DDL fill and select value in gridview

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
 
E

Eliyahu Goldin

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
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top