User control & drop down list

User control & drop down list

Post by Glen Wolinsk » Fri, 02 Nov 2001 00:34:44



I have created a very simple user control.  It only
contains one drop down list with entries that are meant to
be used as navigation links around the site.

In the code-behind in the control (during the index
selection changed event) I check to see which item has
been selected and then do a response.redirect to take a
user to the desired web page.

However, it doesn't work.  The control generates fine and
all my selections are there, but nothing happens when I
make a selection.  It's like the event doesn't even take
place.

Any help would be greatly appreciated.

Thanks,
Glen

 
 
 

User control & drop down list

Post by Saurabh Nand » Sat, 03 Nov 2001 01:07:29


You need to set the AutoPostBack="true" attribute on the DropDownList only
then it will automatically post back when the secection is changed!!

Regards,
Saurabh Nandu
www.MasterCSharp.com
Master C#, the easy way...

 
 
 

User control & drop down list

Post by Glen Wolinsk » Sat, 03 Nov 2001 03:09:59


Sometimes the solution is just way too simple.  That was
the problem (duh on me!).

However, now another question:

The ddl is in a user control which in turn is on a page
object.  How can I reference the ddl programmatically?  Do
I reference it in code in the user control or in the page
that the user control is on?

I want to be able to manipulate this ddl's contents from
the page it is located on so I can adapt the selections to
fit the current page.

Thanks,
Glen

Quote:>-----Original Message-----
>You need to set the AutoPostBack="true" attribute on the
DropDownList only
>then it will automatically post back when the secection
is changed!!

>Regards,
>Saurabh Nandu
>www.MasterCSharp.com
>Master C#, the easy way...

>.

 
 
 

User control & drop down list

Post by Saurab » Sat, 03 Nov 2001 10:32:41


Expose the DDL as a property of the User Control and then from the Page you can easily reference other properties of the DDL placed inside the User Control ..

Regards,
Saurabh Nandu
www.MasterCSharp.com
Master C#, the easy way...

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!