Groups | Blog | Home
all groups > asp.net datagrid control > september 2004 >

asp.net datagrid control : dropdown in a datagrid


GaryB
9/25/2004 3:07:28 PM
I can put a dropdown in a grid column, databind it, and it will work but how
can I get the itemchanged event so that I can do something with it?
thanks,
G

Alvin Bruney [MVP]
9/26/2004 3:09:44 PM
this has been covered a lot in here, you should do a search before posting.
an overview of the process involves adding the control to the grid and
hooking up the event handler. you will need to add the rebind code on each
post since the control embedded in the webform occurs too late in the
pipeline to participate in viewstate.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
[quoted text, click to view]

v-schang NO[at]SPAM online.microsoft.com
9/27/2004 6:24:39 AM
Hi Gary,

I'm viewing the issue and found that it is a duplicated one with another
thread titled:

"dropdown in a grid" in the
Newsgroups: microsoft.public.dotnet.framework.aspnet.

I've posted my reply there and I'd appreciate if you have a look. In
addition, if you feel it convenient that we continue to discuss in that
one, please feel free to followup there. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Govind
9/28/2004 10:41:05 PM

Answer for ur query
<ItemTemplate>

<asp:DropDownList CssClass="dropdown" ID="ddl"
DataTextField= "Desc"
DataValueField= "ID" Runat="server"
OnSelectedIndexChanged="ddl_SelectedIndexChanged()"/>

</ItemTemplate>


In the Code behind write the method as

public void ddl_SelectedIndexChanged(object sender,
System.EventArgs e)
{
// Identify sender.SelectedValue after typecasting it
here.
}


I am also facing with one more problem with datagrid.

I am using two Drodowns with ASP.NET Datagrid/(ASP.20
GridView) . What i want is , on selecting the first
dropdown i want to populate the second dropdown based on
the selection. The dropdown control is places in
ItemTemplate.

Regards,
Govind.

[quoted text, click to view]
AddThis Social Bookmark Button