好久没更新了,发个有意思的,可编辑dropdownlist 控件,感觉自己写的挺牛的呵呵。跟大家共享下

    public class ComboBox:System.Web.UI.WebControls.CompositeControl
    {

        
private TextBox input;
        
private DropDownList select;

        
public TextBox TextBox {

            
get { this.EnsureChildControls(); return input; }
        }

        
public DropDownList DropDownList {

            
get { this.EnsureChildControls(); return select; }
        }



        
protected override void CreateChildControls()
        {
            
//base.CreateChildControls();

            
this.Controls.Clear();
            input 
= new TextBox();
            input.ID 
= "input";

            select 
= new DropDownList();
            select.ID 
=  "select";

            
this.Controls.Add(select);
            
this.Controls.Add(input);
            
this.ChildControlsCreated = true;
        }
        
protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
        {
            
this.EnsureChildControls();

  
//           <select >);
            writer.RenderEndTag();
        
            


        }

    }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-04
  • 2021-10-20
  • 2022-12-23
猜你喜欢
  • 2021-11-17
  • 2022-01-30
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2022-02-07
相关资源
相似解决方案