IT SOLUTIONS
Your TECHNOLOGY partner! 
-Collapse +Expand
Prism
Search Prism Group:

Advanced
-Collapse +Expand Prism Group Home
-Collapse +Expand Message Board
-Collapse +Expand Prism KB
-Collapse +Expand Prism To/From
To/FromCODEGuides
-Collapse +Expand Prism Study Test
PRESTWOODCERTIFIED
-Collapse +Expand Prism Store
PRESTWOODSTORE
-Collapse +Expand Members Only

Prestwood eMagazine

May Edition
Subscribe now! It's Free!
Enter your email:

   ► KBProgrammingDelphi PrismDelphi for ....     Print This   
Go To Random Article
  From the October 2008 Issue of Prestwood eMag
 
Prism Delphi for .Net Archive:
ASP.NET under Delphi
 
Posted 7 years ago on 5/3/2006 and updated 1/20/2009
Take Away:

use of Sender under Delphi for .NET



Let's say you have a DropDownList object on your ASP.NET form, and you want to access the Items property without actually naming the object.  You can do this the same way you would with a Win32 application under Delphi.

The following code will capture the currently selected string each time it changes in the drop-down (note that, under ASP.NET, this only occurs when some reason exists for a "trip to the server", and the user choosing a new drop-down value is NOT such a reason (at least, not when runat="server" is set)).

This assumes the default naming of DropDownList1 for the object:

procedure TWebForm1.DropDownList1_SelectedIndexChanged(sender: System.Object; e: System.EventArgs);
begin
    sItemString := DropDownList(sender).Items.Item[DropDownList(sender).SelectedIndex].ToString;
end;

(we are simply casting the sender argument as a DropDownList, since sender is the object that caused the event, and it's a DropDownList, but we need to "upcast" from Object in order to access the DropDownList properties). 

This makes this code portable to other DropDownLists, regardless of their naming or scoping.


Comments

0 Comments.
Share a thought or comment...
 
Write a Comment...
Full Editor
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post:

Enter your name and security key.

Your Name:
Today's security key = P235A
Enter key:
KB Post Contributed By Joshua Delahunty:
I am a software engineer with many years professional experience, using everything from 6809 assembly language to C, C++, Delphi, Paradox for Windows, and Borland JBuilder.

 KB Article #100369 Counter
1970
Since 4/2/2008
-
  Load Time=less than 1 second.
 
Print This

KB Post Options:
-
 
Have a question? Need our services? Contact us now.
--Mike Prestwood

Call: 916-726-5675

email: info@prestwood.com


473 People Online Now!!  
Online Now: Sign In to see who's online now!  Not a member? Join now. It's free!
Show More...


©1995-2013 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech