HighTechTalks DotNet Forums  

Dropdown Inside Gridview SelectedIndexChange Event

ASP.net Web Controls microsoft.public.dotnet.framework.aspnet.webcontrols


Discuss Dropdown Inside Gridview SelectedIndexChange Event in the ASP.net Web Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Babu
 
Posts: n/a

Default Dropdown Inside Gridview SelectedIndexChange Event - 12-12-2007 , 07:20 AM






I am having DropDownList inside GridView. When the DropDownList SelectedIndex changed a event should fire and how can I able to get the row number for the GridView


Reply With Quote
  #2  
Old   
John Padilla
 
Posts: n/a

Default RE: Dropdown Inside Gridview SelectedIndexChange Event - 12-15-2007 , 02:01 PM






Babu,

Add a SelectedIndexChanged event, within that event you can access some of
the GridView properties such as SelectedIndex. If this doesnt work you can do
a cool work around like this:

I am assuming you have Edit link button set for each gridrow. When you click
the Edit link button the GridView (also Select and Delete) the RowCommand
event is called.

In there can do this:
if (e.CommandName == "Edit")
{
Session["RowSelected"] = Convert.ToInt32(e.CommandArgument);
}

e.CommandArguement gives you the row number and i just add this to the
session variable and later when your in the SelectedIndex Changed event you
can retrieve the session value like this:

if(Session["RowSelected"] != null)
{
int currentRow = (int)Session["RowSelected"];
}

either way you now have the current row number

Hope this helps!

"Babu" wrote:

Quote:
I am having DropDownList inside GridView. When the DropDownList SelectedIndex changed a event should fire and how can I able to get the row number for the GridView



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.