Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

DropDown change event in WebPart

  Asked By: Jordan Lawson         Date: Jan 17, 2010      Category: Sharepoint      Views: 800
 

I have created a custom web part with a drop down. How can I specify the
page to post back once the drop down selected index changes? My code
looks something like this

_myDropDown = New HtmlSelect

_myDropDown.Items.Add("0")

_myDropDown.Items.Add("1")

_myDropDown.Items.Add("2")

AddHandler _myDropDown.ServerChange, AddressOf
_myDropDown_IndexChange

Controls.Add(_myDropDown)

The post back does not happens. Please advise.

Tagged:          

 

4 Answers Found

 
Answer #1       Answered By: Bernice Puckett          Answered On: Jan 17, 2010       

Didi you try

this.DropDownList1.AutoPostBack = true;

DropDownList1.SelectedIndexChanged += new
EventHandler(DropDownList1_SelectedIndexChanged);

 
Answer #2       Answered By: Mackenzie Lewis          Answered On: Jan 17, 2010       

There is no autopostback property related with the control. My code
resides in the createchildcontrols method. Let me know if there is
something I am missing.

 
Answer #3       Answered By: Kurt Gilbert          Answered On: Jan 17, 2010       

Are u using the DropDownListBox Server control? If you
are using that one you should have AutoPostBack
property.

 
Answer #4       Answered By: Jaya Deoghar          Answered On: Jan 17, 2010       

Also make sure that the control is added to the controls collection. If
the control is not added to the controls collection the postback will
not fire.

 
Didn't find what you were looking for? Find more on DropDown change event in WebPart Or get search suggestion and latest updates.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].