Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

DropDown change event in WebPart

  Asked By: Jordan    Date: Jan 17    Category: Sharepoint    Views: 2934

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.

Share: 

 

4 Answers Found

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

Didi you try

this.DropDownList1.AutoPostBack = true;

DropDownList1.SelectedIndexChanged += new
EventHandler(DropDownList1_SelectedIndexChanged);

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

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

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

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.




Tagged: