Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: How to capture SelectedIndexchanged event of dropdownlist in Datagrid

Reply
Thread Tools

Re: How to capture SelectedIndexchanged event of dropdownlist in Datagrid

 
 
Shiva
Guest
Posts: n/a
 
      10-31-2004
Use the OnSelectedIndexChanged attribute of the <aspropDownList> element
to hook to your server-side event.

Eg:

In .aspx file:
....
<EditItemTemplate>
<aspropDownList id="ddl" runat=server
OnSelectedIndexChanged="SelectionChanged" />
<EditItemTemplate>
....

In code-behind file:

//C#
protected void SelectionChanged (object sender, EventArgs e)
{
DropDownList d = (DropDownList)sender;
// Use d here
}

HTH.

"Uma Shanmugam via .NET 247" <(E-Mail Removed)> wrote in message
news:ePbg9$(E-Mail Removed)...
(Type your message here)

--------------------------------
From: Uma Shanmugam

Everyone,
I have a datagrid and it has a dropdownlist in the Edit mode.I want to
capture the selectedIndexChanged event of the dropdownlist. I tried
ItemCommand event and then realised that it is fired when a button is
clicked.Any help will be greatly appreciated.

Thanks in Advance
Uma Shanmugam

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>/ZIKIJ+ZZkqlTW/OJYF/Cg==</Id>


 
Reply With Quote
 
 
 
 
=?Utf-8?B?WXVraQ==?=
Guest
Posts: n/a
 
      02-25-2005
Hi Shiva,

Yes, selectchanged is captured. But the SelectedItemIndex still remain
without change. Any Idea?

Yuki

"Shiva" wrote:

> Use the OnSelectedIndexChanged attribute of the <aspropDownList> element
> to hook to your server-side event.
>
> Eg:
>
> In .aspx file:
> ....
> <EditItemTemplate>
> <aspropDownList id="ddl" runat=server
> OnSelectedIndexChanged="SelectionChanged" />
> <EditItemTemplate>
> ....
>
> In code-behind file:
>
> //C#
> protected void SelectionChanged (object sender, EventArgs e)
> {
> DropDownList d = (DropDownList)sender;
> // Use d here
> }
>
> HTH.
>
> "Uma Shanmugam via .NET 247" <(E-Mail Removed)> wrote in message
> news:ePbg9$(E-Mail Removed)...
> (Type your message here)
>
> --------------------------------
> From: Uma Shanmugam
>
> Everyone,
> I have a datagrid and it has a dropdownlist in the Edit mode.I want to
> capture the selectedIndexChanged event of the dropdownlist. I tried
> ItemCommand event and then realised that it is fired when a button is
> clicked.Any help will be greatly appreciated.
>
> Thanks in Advance
> Uma Shanmugam
>
> -----------------------
> Posted by a user from .NET 247 (http://www.dotnet247.com/)
>
> <Id>/ZIKIJ+ZZkqlTW/OJYF/Cg==</Id>
>
>
>

 
Reply With Quote
 
 
 
 
Jc Morin
Guest
Posts: n/a
 
      02-25-2005
Did you assign the value in the Page_Load event ? maybe you didn't set the
routine in

if (!IsPostBack) {

}

so after postback the original value is re-apply before you read the value
again...

--------------------------
Jean-Claude Morin, MCP
Software Developer
2k1Soft/kCentric, Canada


"Yuki" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Shiva,
>
> Yes, selectchanged is captured. But the SelectedItemIndex still remain
> without change. Any Idea?
>
> Yuki
>
> "Shiva" wrote:
>
> > Use the OnSelectedIndexChanged attribute of the <aspropDownList>

element
> > to hook to your server-side event.
> >
> > Eg:
> >
> > In .aspx file:
> > ....
> > <EditItemTemplate>
> > <aspropDownList id="ddl" runat=server
> > OnSelectedIndexChanged="SelectionChanged" />
> > <EditItemTemplate>
> > ....
> >
> > In code-behind file:
> >
> > //C#
> > protected void SelectionChanged (object sender, EventArgs e)
> > {
> > DropDownList d = (DropDownList)sender;
> > // Use d here
> > }
> >
> > HTH.
> >
> > "Uma Shanmugam via .NET 247" <(E-Mail Removed)> wrote in message
> > news:ePbg9$(E-Mail Removed)...
> > (Type your message here)
> >
> > --------------------------------
> > From: Uma Shanmugam
> >
> > Everyone,
> > I have a datagrid and it has a dropdownlist in the Edit mode.I want to
> > capture the selectedIndexChanged event of the dropdownlist. I tried
> > ItemCommand event and then realised that it is fired when a button is
> > clicked.Any help will be greatly appreciated.
> >
> > Thanks in Advance
> > Uma Shanmugam
> >
> > -----------------------
> > Posted by a user from .NET 247 (http://www.dotnet247.com/)
> >
> > <Id>/ZIKIJ+ZZkqlTW/OJYF/Cg==</Id>
> >
> >
> >



 
Reply With Quote
 
leoykl leoykl is offline
Junior Member
Join Date: Jun 2012
Posts: 1
 
      06-14-2012
did u set the autopostback to true ??


<aspropDownList ID="ddlProductType" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlProductType_SelectedInd exChanged">
</aspropDownList>





Quote:
Originally Posted by Jc Morin View Post
Did you assign the value in the Page_Load event ? maybe you didn't set the
routine in

if (!IsPostBack) {

}

so after postback the original value is re-apply before you read the value
again...

--------------------------
Jean-Claude Morin, MCP
Software Developer
2k1Soft/kCentric, Canada


"Yuki" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Shiva,
>
> Yes, selectchanged is captured. But the SelectedItemIndex still remain
> without change. Any Idea?
>
> Yuki
>
> "Shiva" wrote:
>
> > Use the OnSelectedIndexChanged attribute of the <aspropDownList>

element
> > to hook to your server-side event.
> >
> > Eg:
> >
> > In .aspx file:
> > ....
> > <EditItemTemplate>
> > <aspropDownList id="ddl" runat=server
> > OnSelectedIndexChanged="SelectionChanged" />
> > <EditItemTemplate>
> > ....
> >
> > In code-behind file:
> >
> > //C#
> > protected void SelectionChanged (object sender, EventArgs e)
> > {
> > DropDownList d = (DropDownList)sender;
> > // Use d here
> > }
> >
> > HTH.
> >
> > "Uma Shanmugam via .NET 247" <(E-Mail Removed)> wrote in message
> > news:ePbg9$(E-Mail Removed)...
> > (Type your message here)
> >
> > --------------------------------
> > From: Uma Shanmugam
> >
> > Everyone,
> > I have a datagrid and it has a dropdownlist in the Edit mode.I want to
> > capture the selectedIndexChanged event of the dropdownlist. I tried
> > ItemCommand event and then realised that it is fired when a button is
> > clicked.Any help will be greatly appreciated.
> >
> > Thanks in Advance
> > Uma Shanmugam
> >
> > -----------------------
> > Posted by a user from .NET 247 (http://www.dotnet247.com/)
> >
> > <Id>/ZIKIJ+ZZkqlTW/OJYF/Cg==</Id>
> >
> >
> >
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How to capture SelectedIndexchanged event of dropdownlist in Datagrid The Colonel ASP .Net 0 01-24-2005 07:10 AM
Re: How to capture SelectedIndexchanged event of dropdownlist in Datagrid The Colonel ASP .Net 0 01-24-2005 06:20 AM
Re: How to capture SelectedIndexchanged event of dropdownlist in Datagrid The Colonel ASP .Net 0 01-24-2005 06:17 AM
Re: How to capture SelectedIndexchanged event of dropdownlist in Datagrid Arthur Dent ASP .Net 0 12-23-2004 02:28 AM
Re: How to capture SelectedIndexchanged event of dropdownlist in Datagrid Shiva ASP .Net 0 11-17-2004 10:48 AM



Advertisments