Solved

asp.net/c#/dropdown dynamic

Posted on 2011-09-23
2
234 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

867 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

15 Experts available now in Live!

Get 1:1 Help Now