Solved

asp.net/c#/dropdown dynamic

Posted on 2011-09-23
2
235 Views
Last Modified: 2012-06-27
I have attached codes and have dropdown in aspx frontend.
What I really want to do is to put city/state in into placeholder inside of <div></div>
and show on the aspx.

How can I connect them?
How can I validate city/state? Assume if I select 5 in dropdown.
5 pairs of city/state will be shown. and I need to make sure the user enters all 5 pairs.

Thanks
protected void DdlTotalLocation_SelectedIndexChanged(object sender, EventArgs e)
    {
        int TotalLocationCount = int.Parse(DdlTotalLocation.SelectedValue);
        for (int i = 0; i < TotalLocationCount; i++)
        {
            TextBox CityTextBox = new TextBox();
            CityTextBox.ID = "City_" + i;
            TextBox StateTextBox = new TextBox();
            StateTextBox.ID = "State_" + i;

        }

    }

Open in new window

0
Comment
Question by:Webboy2008
2 Comments
 
LVL 51

Accepted Solution

by:
HainKurt earned 500 total points
ID: 36590721
aspx:

<div id=divSelect runat=server></div>

C# Line 10:

divSelect.Controls.Add(CityTextBox);
divSelect.Controls.Add(StateTextBox);
divSelect.Controls.Add(New LiteralControl("<br/>");

0
 

Author Comment

by:Webboy2008
ID: 36590728
alert message to this line: divSelect.Controls.Add(New LiteralControl("<br/>");
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now