About of DataGrid, RadiButtonList and DropDownList From Mexico City

R

Ricardo Ostos {MX}

Hi, friends as are wishing them the best thing to them of this life.

I have:
VS .NET Pro 2003
Win 2000 Pro with SP4
Sql Server 2000 with SP3
Developer Web, with C#


I have a DataGrid where I show all my products I have a column of
Templete type, where I show a RadioButtonList, depending where the client
wishes that its product is given to him, have 5 options, depending on the
option I must show a DropDownList of the possible options.

It already manages to be able to capture the events of the
RadioButtonList, and its changes, what I have not been able now to do is
to be able to add the data to my DropDownList from the data base.

I am handling a single DropDownList to perfomance for application.

I have not been able to do that my DropdownList this
qualifying and later to give of discharge the registries him.

I have this code when the RadioButtonList changes of value:

public void Modifica1 (object sender, EventArgs e)
{
string TextoRB = "";
RadioButtonList rb = new RadioButtonList();
rb = (RadioButtonList) sender;

TextoRB = rb.SelectedItem.Value;

DropDownList lst = new DropDownList();
lst.FindControl("lstGeneral");

TextBox txt = new TextBox();
txt.FindControl("txtDireccion");


switch (TextoRB)
{
case "1":
lst.Enabled = true;
lst.Items.Add("Distribuidora");
txt.Text = "Distribuidora";
break;
case "2":
lst.Enabled = true;
lst.Items.Add("Domicilio Conocido");
txt.Text = "Domicilio Conocido";
break;
case "3":
lst.Enabled = true;
lst.Items.Add("Otra Distribuidora");
txt.Text = "Otra Distribuidora";
break;
case "4":
lst.Enabled = true;
lst.Items.Add("Carrocera");
txt.Text = "Carrocera";
break;
case "5":
lst.Enabled = true;
lst.Items.Add("Otro");
txt.Text = "Otro";
break;
}
}

The page does not mark ningun error to me but it does not add the data
either to me, I am testing as much with the DropDownList as with a TextBox
and no me it respects them.

Some idea?
Beforehand I appreciate its attention to them.
Greetings from Mexico City.

P.D. Excuse my english is not absolutely good.
 
R

Ricardo Ostos {MX}

I have solution.

Add this code:
DataGridItem dgi = (DataGridItem) rb.Parent.Parent;
DropDownList lstGeneral = (DropDownList) dgi.FindControl("lstGeneral");
TextBox txtDireccion = (TextBox) dgi.FindControl("txtDireccion");

Show the control and modify class and everithing.

Greetings from Mexico City.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,082
Members
48,773
Latest member
Kaybee

Latest Threads

Top