469,631 Members | 1,532 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,631 developers. It's quick & easy.

Binding Dynamically Named Drop Downs in a Repeater

I have searched high and low for a solution to this and I dont think
its possible.... but I hope not.

What I have is a list of items with various values that can be changed
via a drop down. Each of the items will have a value that was
previously selected by the user. When the data is displayed, the
previously selected values must be set as the default in the drop down.

The ids of each drop down are created acording to their index in the
backend list that is bound to the repeater.

Heres a snipit...

<asp:Repeater id="items">
<aspDropDown id="size<%#getIndex()%>" datasource="<%#
container.dataitem.sizes %>"/>
</asp:Repeater/>

.....
container.dataitem.sizes returns a object that implments IList
getIndex returns an counter then increments it

problems:

1) The datasource property for the drop down ends up being set to a
string denoting the type of object returned by the sizes property. i.e.
datasource="System.Collection.ArrayList"

2)How to set the selected item in the given drop down to a value based
on something like container.dataitem.selectedsize. Since the name of
the control is named at bind time, using any of the repeater events
seems to be useless unless the index can be passed to them.

Is there a way to pass the dropdown object to a function like
<aspDropDown id="size<%#getIndex()%>" datasource="<%#
fillBox(container.dataitem,me)%>

where I can then set the default value and bind the list..?
Also, the repeater doesnt offer an index to determine how many elements
are currently bound? Something like <%#container.index%>???

Thanks in advance, I hope this stuff is possible.

Nov 23 '05 #1
0 1421

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by BryanS | last post: by
3 posts views Thread by CSharpguy | last post: by
5 posts views Thread by DotNetNewbie | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.