Link to home
Start Free TrialLog in
Avatar of Webboy2008
Webboy2008

asked on

asp.net/ascx

The attached codes came from ascx code behind.
My issue is I don't know how to create public class in get/set
with the dynamic city/state pairs. The codes basically have dropdown from 1 to 25
and value is used to determine how many pairs of city/state textbox will be shown up.
 
CityTextBox.ID = "City_" + i;
StateTextBox.ID = "State_" + i;

I will need to get get/set like
public int TotalLocation { get { return int.Parse(DdlTotalLocation.Text); } }

Please help me and see you can finish my rest of the tasks.

Thanks,

500 pts for working codes.
protected void DdlTotalLocation_SelectedIndexChanged(object sender, EventArgs e)
    {
        int TotalLocationCount = int.Parse(DdlTotalLocation.SelectedValue);
        if (TotalLocationCount >= 1)
        {
            LblCityStateList.Visible = true;
            for (int i = 0; i < TotalLocationCount; i++)
            {
                //TextBox CityTextBox = new TextBox();
                Obout.Interface.OboutTextBox CityTextBox = new Obout.Interface.OboutTextBox();
                CityTextBox.ID = "City_" + i;
                CityTextBox.Width = 170;
                CityTextBox.TabIndex = 1;
                //TextBox StateTextBox = new TextBox();
                Obout.Interface.OboutTextBox StateTextBox = new Obout.Interface.OboutTextBox();
                StateTextBox.ID = "State_" + i;
                StateTextBox.Width = 100;
                StateTextBox.TabIndex = 2;
                DivSelectCity.Controls.Add(CityTextBox);
                DivSelectState.Controls.Add(StateTextBox);
            }
        }
        else
            LblCityStateList.Visible = false;
    }
    //=====================================================================================
    public int TotalLocation { get { return int.Parse(DdlTotalLocation.Text); } }

Open in new window

Avatar of Eyal
Eyal
Flag of Israel image

need clarification here...
would you like TotalLocation to return you the total lines generated by DdlTotalLocation_SelectedIndexChanged?
Avatar of Webboy2008
Webboy2008

ASKER

yes
ASKER CERTIFIED SOLUTION
Avatar of Eyal
Eyal
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial