Ver Mensaje Individual
  #2 (permalink)  
Antiguo 29/03/2011, 14:45
Avatar de Aquaventus
Aquaventus
 
Fecha de Ingreso: junio-2010
Ubicación: Lima-Peru , En el alba de la naturaleza
Mensajes: 2.105
Antigüedad: 13 años, 10 meses
Puntos: 267
Respuesta: RadioButtonList dinámico

Hola artspider create un metodo asi :

Código c#:
Ver original
  1. //tiene que tener los parametros de eventos -> (object sender, EventArgs e)
  2. private void RADIOBUTTON_SELECCIONADO(object sender, EventArgs e)
  3. {
  4.           //Aqui iria tu codigo
  5.           //...
  6. }

luego ese método lo asocias a tu radiobuttonlist :

Código c#:
Ver original
  1. //Asi como para un boton es un evento click
  2. //this.btngenerar.Click += new EventHandler(btngeneraf_Click);
  3.  
  4. //Aqui lo asocias segun tu evento
  5. this.RADIOBUTTONLIST.EVENTO += new EventHandler(RADIOBUTTON_SELECCIONADO);

este ultimo codigo de asociacion debe ir al momento que CREAS tu RADIOBUTTONLIST

Código c#:
Ver original
  1. private void AddRadioButton(string Pregunta, string opciones, int Cantidad)
  2. {
  3. RadioButtonList RadioList = null;
  4.  
  5. try
  6. {
  7. RadioList = new RadioButtonList();
  8. RadioList.ID = "Uno";
  9. RadioList.Items.Add("Radio 1");
  10. RadioList.Items.Add("Radio 2");
  11. RadioList.Items.Add("Radio 3");
  12.  
  13. this.RadioList.EVENTO += new EventHandler(RadioList _SELECCIONADO);
  14.  
  15. PnlControl.Controls.Add(RadioList);
  16. PnlControl.Controls.Add(new LiteralControl("<b/>"));
  17.  
  18. }
  19. catch (Exception exp)
  20. {
  21. throw new Exception(exp.Message);
  22. }
  23. }
Espero te haya aclarado el panorama. Saludos!
__________________
Internet es tener todo el conocimiento global a tu disposición.
Desarrollo de Software - Ejemplos .Net

Última edición por Aquaventus; 29/03/2011 a las 15:06