Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 22nd, 2012  |  syntax: C#  |  size: 1.05 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Web.UI.WebControls;
  6. using Logic;
  7. using System.Data;
  8. using System.Data.Entity;
  9.  
  10. namespace UserControl
  11. {
  12.     public class UC2 : System.Web.UI.WebControls.WebControl
  13.     {
  14.         Label label = new Label();
  15.  
  16.         public string Etiqueta
  17.         {
  18.             get { return label.Text; }
  19.             set { label.Text = value; }
  20.         }
  21.  
  22.         DropDownList ddl = new DropDownList();
  23.  
  24.         public string ValorSeleccionado
  25.         {
  26.             get { return ddl.SelectedValue;}
  27.         }
  28.  
  29.         protected override void OnInit(EventArgs e)
  30.         {
  31.             label.ID = this.ID + "_lbl";
  32.             this.Controls.Add(label);
  33.            
  34.             Logica ddlLogic = new Logica();
  35.             ddl.ID = this.ID + "_ddl";
  36.             ddl.DataSource = ddlLogic.cargar();
  37.             ddl.DataTextField = "RegionDescription";
  38.             ddl.DataBind();
  39.             this.Controls.Add(ddl);
  40.  
  41.             base.OnInit(e);
  42.         }
  43.     }
  44. }