Adding AutoPostBack to a webcontrol

T

Thomas Jespersen

Hi

I have a webcontrol, which has a DropDownList and some other controls.

I want to enable AutoPostBack on the DropDownList, but can't figure out how
to do it.

I tried setting myDropDownlist.AutoPostBack = true, but it doesn't make any
differences.

What am I missing.

Thomas
 
J

jeff

Are you setting the postback event on the Page Load method? Try adding it
at the control level on the page.

<dropdownlist autopostback=true id="ddl" runat="server" />
 
T

Thomas Jespersen

Hi

I do not have a page! It is a webcontrol in a control library (C# only), and
the control is created programmatically. That's my problem.

How do I set AutoPostBack on a control created programmatically?

Thomas
 
C

CaffieneRush

You can turn on AutoPostBack in your control before or during your
control's Load event.

Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
MyBase.OnLoad(e)
myDropDownlist.AutoPostBack = true
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top