DropDownList alternative

A

Altman

I currently have a page that has many dropdowns where each one is
dependent on the previous one's selection. Right now I am using
postbacks on each drop down list to fill the next. An example of what
I am doing would be like having dropdown1 have a list of states. When
the user selects the state it does a postback and fills dropdown2 with
the major cities in that state. This obviously is not a nice
interface. I know Atlas (MS Ajax framework currently in beta) can do
this with callbacks and clean it up. But I have another idea and being
I don't have alot of web background I was wondering if this was a good
idea or if there is unforseen problems that would be caused. I don't
want to spend alot of time getting this to work and then find out it
was a stupid idea.

My idea is to create a control that has a textbox (readonly) a hidden
field and a button (or picture link). When the user clicks on the
button or link, I would add an IFRAME through javascript that would
link to a page that has a asp.net datagrid. I could then provide a
search capability and sorting. The user would click on the item, and
it will fill the textbox, and the hidden field with the ID.

Is there any problems with using the iframe that I am not aware of? Is
this a good idea?
 
G

Gaurav Vaish \(www.EdujiniOnline.com\)

search capability and sorting. The user would click on the item, and
it will fill the textbox, and the hidden field with the ID.

Is there any problems with using the iframe that I am not aware of? Is
this a good idea?

Very much doable.
All code, as would be the case, must be from same domain because
cross-scripting is denied access by all browsers.


--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujinionline.com
http://eduzine.edujinionline.com
-----------------------------------------
 
G

GroupReader

I've never actually done anything like this, but I've been developing
in ASP.Net for several years. Here's some feedback for what it's
worth.
1. I assume the IFrame will be filled with content from the same
website and server. Otherwise, there might be security issues.
2. You'll have to work out a way to pass data back & forth between the
containing page and the IFrame. Popping up the IFrame with the correct
list is the easy part, but how will your containing page know which
items you selected in the IFrame? Be careful using Session state to
store this information... you'll need to make sure everything works
even if you have multiple custom-dropdowns on one page.
3. How will your containing page know when you are "done" selecting
items in the IFRAME? This may be a stupid question, but I just can't
picture how it will work.
4. It can sometimes be a pain trying to get the drop-down to work in a
way that doesn't seem "clunky" to your users... click the image, you
get the dropdown. When does the drop-down go away? Under exactly what
circumstances, and can you get it to work in a non-clunky fashion?
5. You mentioned the Atlas stuff. This is actually surprisingly
simple to do. I'm not sure it's in beta any more.
6. Another option is to use "ASP 2.0 Client Callbacks"
7. Another option is to just use the XMLHttpRequest javascript object
(ActiveX Object for IE) yourself, which is what Atlas and Client
Callbacks do behind the scenes.
8. An advantage of what you are proposing is that you could create a
"multi-select" dropdown, which is not available using standard controls
(as far as I know).
9. One more option is to do it the "old school way." Download all
data needed to the client and manipulate everything using javascript
and javascript arrays. This still works really well with smaller data
sets since it eliminates the round-trip all together.
 
M

Mark Rae

5. You mentioned the Atlas stuff. This is actually surprisingly
simple to do. I'm not sure it's in beta any more.

That would probably be my first choice if the datasets involved are quite
large.
9. One more option is to do it the "old school way." Download all
data needed to the client and manipulate everything using javascript
and javascript arrays. This still works really well with smaller data
sets since it eliminates the round-trip all together.

That would definitely be my first choice if the datasets involved are quite
small.
 
A

Altman

Thanks for the reply,

The content will come from the same server so this will not be an
issue. I had planned that the IFrame would dissapear when the user
selected an item or I would provide a close icon or link in the IFrame.
As far as filling the fields, I was going to pass the id of the
textbox in the query string of the IFrame and I figured I would be able
to update the textbox from that. I had done similar stuff like that
for dates, I had a calendar icon which opened a new window and when
they selected a date it would close the new window and set the textbox
to the date they selected. One of the big reasons I like the
possibility of this over the Atlas idea is the capability to do a
search. The data that user has to pick from could be rather large
(well over 100 and sometimes close to 500 items). I feel that a
dropdown list with 500 items in it is not that fun to sort through.
That is where I could use the datagrid with paging and a the search
feature to make this more user friendly.
 
B

bruce barker \(sqlwork.com\)

using iframes is a standard ajax approach. make the iframe invisible by
setting width and height to 0. an easy wat to do want you want is to render
a select in the iframe. your client code can then copy the options from the
iframe to the selected dropdrown. client code in ca fire the action and
catch the onload (response). its just a couple line of javascript code code.

-- bruce (sqlwork.com)
 

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

Top