Monday, March 26, 2012

How do I Databind to DropDownListBox with button Onclick

Hi I have javascript calling a webservice which is loading a dataset from an onclick event, which opens a popup window collects information and returns to the main page. I want to just load the data collected from the popup and update the dropdownlist without a postback.

The dataset is loaded and ready to go, I'm not sure how to bind the ds to the dropdown at this point.

Thanks in advance for the help!

Hi

You have an option of populating the DDL using javascript itself by loading the select with options array. But at the cost of not known to the server and not present in view state. If that's okay you can go with that otherwise the good deal would using ajax to load


How would I use ajax to load the dropdownlistbox?


Hi,

Based on my understanding, you opens a popup window to collects information,then you load a dataset based on those information.Where are you loading the dataset? In the popuppage?In the main page?

If you load the dataset in the popup page, It is hard to post your dataset to your main page.

If you just post the collected information to your main page and then load your dataset in the main page, you can do it like this:

place your dropdown contorl in a updatepanel;

pass the collected infoemation to the main page and fire a Ayncpostback to the updatepanel(Loading data from popup to parent window without refreshing the parent window.)

Best Regards,


The update panel will not work as I have 8 independent buttons that need to re populate the different dropdowns on the Main Screen when the Popup closes. Not all the independent buttons are effect the dropdowns at the same time. Is there an extender available that can perform the databind?

Thanks in advance


8independent buttons?

I don't think it is a good design.

Would you please change it?

As far as I know, still no such extender that can perform the databind in that way.


I will create my own extender. Comments on the design are not appreciated, as they are client dictated, and real world...


Hi,

Just a comment...

I think you can pass 8 values to the main page by using "window.opener.document.forms["form1"].elements["xxx"].value = ''".

Happy coding:)

No comments:

Post a Comment