Home >Backend Development >C#.Net Tutorial >.NET compound control input drop-down control

.NET compound control input drop-down control

巴扎黑
巴扎黑Original
2016-12-20 11:16:081310browse

Use System;
Use System.Collections.Generic;
Use System.ComponentModel;
Use System.Text;
Use System.Web;
Use System.Web.UI program;
Use System.Web.UI.WebControls; Used in
System.Collections;

namespace QC_Control
{
  ///


  ///Customized input drop-down box class
  ///

 [ToolboxData("< ;{0}:CustomInputDropdownControl RUNAT=Server> DropDownList(); // Dropdown box
Private TextBox TxtBox = new TextBox();
_values ​​of private Hashtable = new Hashtable(); //The value used to bind the drop-down box

          ///
                                       Value reference variable setting/getting encapsulated method ///

Items that expose Hashtable ViewState of {

                                                                 Value"] = new Hashtable();

                                                                                                                                                             . ”] = value; }
}


                                                                                                                                                                   
                     Public CustomInputDropdownControl ()
                                                                                                                                                                 
               ///Rewrite the control class Rendering method body
         ///  
                                                                                                                                                                                                                                                             . ID = "DDL" + base.ID;
        TxtBox.ID = "TXT"                                                                               using use with use with use using           using using       through using    ‐           ‐ ‐                                                                                                                            --- in print, in, " ='0'> ");
//The reason why clientID is used here is because when in the card option, the .NET program will automatically name the base.ID
        ddlListItem.Attributes.Add ("onChange", getFocusValue (TxtBox.ID, ddlListItem.ID) ; Height: 15px; Border: 0pt;");
                                                                                                                                                                                                    . Keys key)
                                                     ListItem item = new ListItem();
                                                                                                                       ListItem         ); Output); t OUTPUT.WRITE ("& lt;/ span & gt; & lt; span style = 'location is: absolute; border top: solid is 1pt # c1C1C1C1; It is 1pt # C1C1C1; width: 170 pixels, height: 19px; "& gt;");
txtbox.RenderControl ;; "/ +"CRIPT:"+" document.getElementById('"+TxtId +"').value = document.getElementById('"+ddlId +"') available options [document.getElementById('"+ddlId +"').selectedIndex] .value;"ToString();
                                           

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn