Solved

asp.net/c#/dropdown dynamic

Posted on 2011-09-23
2
239 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 56

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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 …
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

627 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