当前位置: 首页>>代码示例>>C#>>正文


C# CheckBox.GetType方法代码示例

本文整理汇总了C#中System.Web.UI.WebControls.CheckBox.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# CheckBox.GetType方法的具体用法?C# CheckBox.GetType怎么用?C# CheckBox.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.WebControls.CheckBox的用法示例。


在下文中一共展示了CheckBox.GetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateClientScriptAttributes

 /// <summary>
 /// Create attribute and funtion for textbox
 /// </summary>
 /// <param name="checkBox">CheckBox to set client attribute</param>
 /// <param name="Event">Event set for checkbox</param>
 /// <param name="Funtion">Value of event - funtion javascript</param>
 /// <param name="ScriptFuntion">String funtion script return</param>
 public static void CreateClientScriptAttributes(CheckBox checkBox, string Event, string Funtion, string ScriptFuntion)
 {
     checkBox.Page.ClientScript.RegisterClientScriptBlock(checkBox.GetType(), checkBox.ID.ToString() + "_" + Event, ScriptFuntion);
     checkBox.Attributes.Add(Event, Funtion);
 }
开发者ID:nguyennc28,项目名称:QuanLy_KhachHang,代码行数:12,代码来源:StringClass.cs

示例2: ClearUIControls

 /// <summary>
 /// Clears the UI controls.
 /// </summary>
 protected new void ClearUIControls()
 {
     foreach (Control objControl in this.Controls)
     {
         foreach (Control objChildControl in objControl.Controls)
         {
             RadioButtonList objRadioButtonList = new RadioButtonList();
             RadioButton objRadioButton = new RadioButton();
             TextBox objTextBox = new TextBox();
             ListBox objListBox = new ListBox();
             CheckBox objCheckBox = new CheckBox();
             RadComboBox objRadCombo = new RadComboBox();
             DropDownList objDropDownList = new DropDownList();
             if (string.Equals(objChildControl.GetType().ToString(), objRadioButtonList.GetType().ToString()))
             {
                 ((RadioButtonList)(objChildControl)).SelectedIndex = 0;
             }
             if (string.Equals(objChildControl.GetType().ToString(), objRadioButton.GetType().ToString()))
             {
                 ((RadioButton)(objChildControl)).Checked = false;
             }
             if (string.Equals(objChildControl.GetType().ToString(), objTextBox.GetType().ToString()))
             {
                 ((TextBox)(objChildControl)).Text = string.Empty;
             }
             if (string.Equals(objChildControl.GetType().ToString(), objListBox.GetType().ToString()))
             {
                 ((ListBox)(objChildControl)).Items.Clear();
             }
             if (string.Equals(objChildControl.GetType().ToString(), objRadCombo.GetType().ToString()))
             {
                 //    On changing the selected Save Search, all RadCombo items are removed. Only Reset them to selected index = 0.
                 ((RadComboBox)(objChildControl)).SelectedIndex = 0;
                 // Clear only Lithology Secondary RadCombo if Lithology Main selected index = 0;
                 if (((RadComboBox)(objChildControl)).ID.Equals(radCboLithologySecondary.ID))
                 {
                     if (radCboLithologyMain.SelectedIndex == 0)
                     {
                         radCboLithologySecondary.Items.Clear();
                     }
                 }
             }
             if (string.Equals(objChildControl.GetType().ToString(), objCheckBox.GetType().ToString()))
             {
                 ((CheckBox)(objChildControl)).Checked = false;
             }
             /// All DropDown Controls set only selected index = 0, should not clear items
             if (string.Equals(objChildControl.GetType().ToString(), objDropDownList.GetType().ToString()))
             {
                 ((DropDownList)(objChildControl)).SelectedIndex = 0;
             }
         }
     }
 }
开发者ID:vijaymca,项目名称:Dotnet,代码行数:57,代码来源:ReservoirAdvSearch.ascx.cs

示例3: GetControlXml

        /// <summary>
        /// 取得Control对应的xml
        /// </summary>
        /// <param name="item">blockfielditem</param>
        /// <param name="tableName">tablename</param>
        /// <param name="id">控件的id</param>
        /// <returns>xml</returns>
        private string GetControlXml(TBlockFieldItem item, string tableName, ref string id)
        {
            WebControl control = null;
            PropertyInfo info = null;

            #region DropDownList
            if (string.Compare(item.ControlType, "combobox", true) == 0)
            {
                control = new WebDropDownList();
                control.ID = string.Format("{0}DropDownList", item.DataField);
                control.Width = new Unit(130, UnitType.Pixel);
                (control as WebDropDownList).DataSourceID = GenWebDataSource(item, tableName, "ComboBox", string.Empty);
                (control as WebDropDownList).DataMember = item.ComboEntityName;
                (control as WebDropDownList).DataTextField = item.ComboTextField;
                (control as WebDropDownList).DataValueField = item.ComboValueField;
                info = control.GetType().GetProperty("SelectedValue");
            }
            #endregion

            #region RefVal
            else if (string.Compare(item.ControlType, "refvalbox", true) == 0)
            {
            #warning GenWebDataSource未完成FSYS_REFVAL部分
                control = new WebRefVal();
                control.ID = string.Format("{0}RefVal", item.DataField);
                if (!string.IsNullOrEmpty(item.RefValNo) || (item.RefField != null))
                {
                    (control as WebRefVal).DataSourceID = GenWebDataSource(item, tableName, "RefVal", string.Empty);
                    (control as WebRefVal).DataBindingField = item.DataField;
                    (control as WebRefVal).DataTextField = FSYS_REFVAL.Tables[0].Rows[0]["DISPLAY_MEMBER"].ToString();
                    (control as WebRefVal).DataValueField = FSYS_REFVAL.Tables[0].Rows[0]["VALUE_MEMBER"].ToString();
                    if (!string.IsNullOrEmpty(item.RefValNo))
                    {
                        IDbConnection conn = WzdUtils.AllocateConnection(FClientData.DatabaseName, FClientData.DatabaseType, false);
                        InfoCommand command = new InfoCommand(FClientData.DatabaseType);
                        command.Connection = WzdUtils.AllocateConnection(FClientData.DatabaseName, FClientData.DatabaseType, true);
                        //command.Connection = conn;
                        command.CommandText = String.Format("Select * from SYS_REFVAL_D1 where REFVAL_NO = '{0}'", item.RefValNo);
                        IDbDataAdapter adapter = WzdUtils.AllocateDataAdapter(FClientData.DatabaseType);
                        adapter.SelectCommand = command.GetInternalCommand();
                        DataSet dataset = new DataSet();
                        WzdUtils.FillDataAdapter(FClientData.DatabaseType, adapter, dataset, item.RefValNo);
                        if (dataset != null && dataset.Tables.Count > 0 && dataset.Tables[0].Rows.Count > 0)
                        {
                            foreach (DataRow DR in dataset.Tables[0].Rows)
                            {
                                WebRefColumn refcolumn = new WebRefColumn();
                                refcolumn.ColumnName = DR["FIELD_NAME"].ToString();
                                refcolumn.HeadText = DR["HEADER_TEXT"].ToString();
                                refcolumn.Width = 100;
                                (control as WebRefVal).Columns.Add(refcolumn);
                            }
                        }
                    }
                    info = control.GetType().GetProperty("BindingValue");
                }
                else
                {
                    control = new TextBox();
                    control.ID = string.Format("{0}TextBox", item.DataField);
                    (control as TextBox).MaxLength = item.Length;
                    info = control.GetType().GetProperty("Text");
                }

            }
            #endregion

            #region DateTimePicker
            else if (string.Compare(item.ControlType, "datetimebox", true) == 0)
            {
                control = new WebDateTimePicker();
                control.ID = string.Format("{0}DateTimePicker", item.DataField);
                (control as WebDateTimePicker).MaxLength = item.Length;
                if (string.IsNullOrEmpty(item.EditMask))
                {
                    (control as WebDateTimePicker).DateFormat = dateFormat.ShortDate;
                }
                if (item.DataType == typeof(DateTime))
                {
                    info = control.GetType().GetProperty("Text");
                }
                else if (item.DataType == typeof(string))
                {
                    (control as WebDateTimePicker).DateTimeType = dateTimeType.VarChar;
                    info = control.GetType().GetProperty("DataString");
                }
            }
            #endregion

            #region ValidateBox
            else if (string.Compare(item.ControlType, "validatebox", true) == 0)
            {
                control = new WebValidateBox();
//.........这里部分代码省略.........
开发者ID:san90279,项目名称:UK_OAS,代码行数:101,代码来源:fmJQueryWebForm90.cs

示例4: ClearUIControls

        /// <summary>
        /// Clears the UI controls.
        /// </summary>
        protected void ClearUIControls()
        {
            foreach(Control objControl in this.Controls)
            {
                foreach(Control objChildControl in objControl.Controls)
                {
                    RadioButtonList objRadioButtonList = new RadioButtonList();
                    RadioButton objRadioButton = new RadioButton();
                    TextBox objTextBox = new TextBox();
                    ListBox objListBox = new ListBox();
                    CheckBox objCheckBox = new CheckBox();
                    RadComboBox objRadComboBox = new RadComboBox();
                    DropDownList objDropDownList = new DropDownList();
                    if(string.Equals(objChildControl.GetType().ToString(), objRadioButtonList.GetType().ToString()))
                    {
                        foreach(ListItem lstRadioItem in ((RadioButtonList)(objChildControl)).Items)
                        {
                            lstRadioItem.Selected = false;
                        }
                    }
                    if(string.Equals(objChildControl.GetType().ToString(), objRadioButton.GetType().ToString()))
                    {
                        ((RadioButton)(objChildControl)).Checked = false;
                    }
                    if(string.Equals(objChildControl.GetType().ToString(), objTextBox.GetType().ToString()))
                    {
                        ((TextBox)(objChildControl)).Text = string.Empty;
                    }
                    if(string.Equals(objChildControl.GetType().ToString(), objListBox.GetType().ToString()))
                    {
                        ((ListBox)(objChildControl)).Items.Clear();
                    }
                    if(string.Equals(objChildControl.GetType().ToString(), objCheckBox.GetType().ToString()))
                    {
                        ((CheckBox)(objChildControl)).Checked = false;
                    }

                }
            }
        }
开发者ID:vijaymca,项目名称:Dotnet,代码行数:43,代码来源:UIHelper.cs


注:本文中的System.Web.UI.WebControls.CheckBox.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。