dropdown in a datagrid

G

GaryB

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
 
A

Alvin Bruney [MVP]

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.
 
S

Steven Cheng[MSFT]

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.)
 
G

Govind

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.
-----Original Message-----
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
GaryB said:
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


.
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top