Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DDL fill and select value in gridview

1 view
Skip to first unread message

mik

unread,
May 11, 2008, 10:47:34 AM5/11/08
to
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

Eliyahu Goldin

unread,
May 12, 2008, 4:44:25 AM5/12/08
to
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


"mik" <m...@nomail.it> wrote in message
news:OAT7gY3s...@TK2MSFTNGP05.phx.gbl...

0 new messages