ComboBox

T

Tamir Berger

Hi,

I have an ASP.NET form that includes several combo Boxes.
The first Combo is loaded with items on Page_load.
The second depends on the item selected on the first, the third on the
second and so on.

I don't want to transfer all the data needed with the form and also want to
avoid page refresh on every item change.

What is the best method for doing this?
I heard about xmlhttp and WS but I don't know if any of those technologies
is appropriate and how to use them in the project.

Samples will help me very much.

10X.
 
K

Kevin Spencer

If I understand you correctly, you've just ruled out the only 2
possibilities you have. Think about it. The data to populate the combo boxes
is stored on the server. Therefore, you either have to (1) pass it all to
the client to avoid having to PostBack, or (2) PostBack to get the data. If
you can think of a third way, you're probably due the Nobel Prize!

HTH,

Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Big things are made up of
lots of Little things.
 
T

Tom Johnson

Hello

you could also use the webservice behavior to obtain the new info and
transorm it with xsl to a <select>. or with the xmlhttp object...

other idea?



Anatoly said:
We are using a hidden iframe for this
1)Put an IFRAME with style="display:none" in this web form.
2)On combo change(client-side) write something like this:

frmServerSide.location.href =
'serverSide.aspx?Function=FillCompanyCombo&cboRegion=' +
document.frmCaseList.cboRegion.value + '&defaultCompany=' + defaultCompany;

where frmServerSide is name of IFRAME

3)in serverSide.aspx write on Page_Load() get the appropriate data (in
dataset for example) and do in loop

Response.Write("<script>")
Response.Write( " var oSelect = parent." + ComboName + "; ")
Response.Write( " var oOption; ")
//cleans the combo before filling
Response.Write( " while(oSelect.options.length>0) ")
Response.Write(" oSelect.options.remove(0);")
foreach(DataRow Row in Data.Rows){
Response.Write( " oOption = document.createElement(""OPTION"");")
Response.Write( " oOption.text = '" + Row[TextField].ToString() + "';")
Response.Write( " oOption.value = '" + Row[ValueField] + "';")
Response.Write( " oSelect.add(oOption); ")
}

ComboName is DropDownList.ClientId which you may pass from first form

HTH

Tamir Berger said:
Hi,

I have an ASP.NET form that includes several combo Boxes.
The first Combo is loaded with items on Page_load.
The second depends on the item selected on the first, the third on the
second and so on.

I don't want to transfer all the data needed with the form and also want to
avoid page refresh on every item change.

What is the best method for doing this?
I heard about xmlhttp and WS but I don't know if any of those technologies
is appropriate and how to use them in the project.

Samples will help me very much.

10X.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top