Accessing a DropDownList inside a repeater...

j_coreil
j_coreil used Ask the Experts™
on
I have a repeater and within it I have multiple textboxes and 2 repeaters. It is bound to a DataTable within a DataSet.

1) If I change the values of the bound textboxes will it change/update the value within the dataset/datatable?

2) How do I access the DropDownList(s) within the repeater to a) assign values since it is not bound to the dataset/datatable b) get the selected value within the DropDownList?

Basically I have a bunch or information that cannot be put into a datagrid because of time constraints and the requirment of this having to be "pretty" for the users. They need to see all the current data and be able to add more rows. If this is vague then please tell me and I will explain more. Any and all help will be very much appreciated.

Jonathan Coreil
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
VGR

Commented:
is this Delphi ?

Commented:
Might be .NET, since he uses repeater object.

Author

Commented:
Man I'm sorry, I thought I posted this inside the ASP section. Yes it is .NET.
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

VGR

Commented:
then sorry, man, I know only real development stuff
send me ur code. I will write ADO code to do that.
pls click accept button whenever u satisfied with my answer

Author

Commented:
First off I would like to say that the comment about real development stuff is uncalled for. Sure .NET has it's holes and limitations but come on, there needs to be a mutual respect between developers regarding which enviroment he or she is developing in. This was given to me at my work and to tell you the truth I would not have chose to do to what needs to be done using the architecture they have in place. But that is all besides the point. .NET is a language that alot of people use and are going to use, mainstream corporate America is moving away from Delphi and Perl and everything else so us developers who do this for a living will have to move away from Delphi, Java, JSPs, Beans, Corba, and all those type of tools. I wish this were not true but it is. XML via MS Soap as the middleware is winning and .NET is the enviroment that most people are using. So... Learn something about ASPs or keep your comments to yourself.

Note I didn't no degrade Delphi or anything because I have developed in almost every language listed here.

I'll post my code ASP HTML and Code behind soon.
VGR
Commented:
well, it was humour, but as you want to go off-road, let's go (it'll be my last message in this thread) :

1) I don't see ASP.Net as a language but a framework. The language can be VBasic Script, C# or even Delphi
2) I don't see ASP.Net winning. In fact, it CAN NOT win. Why ? Because it's tied to a share-losing platform : OS and webserver :
IIS is now at 25% market share, going down... Apache is winning.
Windows can only lose market shares, and it does (thanks linux and Mac OS/OS X)

3) Apache, PHP and MySql are platform-independent. IIS, ASP.Net and SQL-Server are the exact contrary. Who do you think is gonna win in a "globalized" world ? ;-)

4) PHP pseudo-compiled is faster than ASP.Net (pseudo-compiled too), as PHP interpreted is faster than ASP (interpreted too)

5) if you ***really*** look for a language/environment which is fast, serious, reliable, and platform-independent, then go for Delphi ;-)
(AS/400, Windows, Kylix on linux, Delphi/.Net on .Net)

Author

Commented:
I totally agree about PHP being faster. You are also correct about .NET being a framework and ASP not being a language. I will always admit all of this but just please don't go around saying that ASP .NET is not a real development stuff. It's sad enough that I have to settle for a job using .NET but come on, I have pride too lol.

1. No, the Dataset/Datatable will not get updated

2A. You can access the Dropdown list as cboTest.Items(0) in the code behind where cboTest is the Id of the dropdowns that is created inside the repeater control and Items(0) refers the first control in the repeater.

2B. cboTest.Items(0).Selected gives weather a particular option is selected in the drop down.
To get back to the issue at hand.....

To add a value to a dropdownlist:

Dim newListItem As New ListItem()
newListItem.Text = "my new item"

Booking.Items.Add(newListItem)
or to add at a specific index:
Booking.Items.Insert(0, newListItem)

To retrieve a value:
dropdownlist.SelectedItem.Value

It makes no difference if the dropdownlist is databound or not this will work for either but to update the dataset you will have to do it explicitly

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial