Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old September 21st, 2005, 11:03 AM
Friend of Wrox
 
Join Date: Apr 2004
Location: San Francisco, CA, USA.
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default catching the OnSelectedIndexChanged event

How can I catch/Handle the OnSelectedIndexChanged of a Dropdown list control that is inside a datagrid?

Thanks!

  #2 (permalink)  
Old October 5th, 2005, 02:51 PM
Registered User
 
Join Date: Oct 2005
Location: , Virginia, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

My experience is in using a table instead of a datagrid so I don’t know if it can be done in a datagrid or if you will have to resort to a DataList or DataTable but I am hoping you can glean something from it in either case. What I did was created a new control that inherited from the dropdown list with the addition of a variable that allowed me to check which line of the data it was triggered from. When I created the row for the datatable and thus the dropdown list I set this variable to the itemID value and created an event handler that handled the output from the dropdown list on each row of the data.

In the handler I then checked for this code to know which line triggered the event.
This isn’t the exact code (is coming from memory)and thus may need some tweaking but basically in C#::

private class myDropDownList: DropDownList()
{
int dataRowID

}
and
private void my DropDownListHandler(object sender, System.EventArgs e)
{
myDropDownList ddl=object as myDropDownList;
itemID=ddl.dataRowID;

//rest of the handler code
}

let me know if this helps



Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 6, OnSelectedIndexChanged roman BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 5 June 16th, 2008 05:02 PM
onSelectedIndexChanged event not firing??? MTLedari ASP.NET 2.0 Basics 5 December 19th, 2006 10:35 AM
OnSelectedIndexChanged event not firing ethertt77 ASP.NET 2.0 Basics 2 February 20th, 2006 07:34 PM
Catching exceptions thrown from an event... jacob C# 5 December 6th, 2005 12:48 PM
DropDownList - OnSelectedIndexChanged LarryH ASP.NET 1.0 and 1.1 Basics 1 February 2nd, 2005 12:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.