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


C# CheckBox.RenderControl方法代码示例

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


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

示例1: RenderContents

		/// <summary>
		/// 
		/// </summary>
		/// <param name="writer"></param>
		/// <author>
		/// Created by Iulian Iuga; 30 December, 2002
		/// </author>		
		protected void RenderContents( HtmlTextWriter writer )
		{
			TableRow _tr = new TableRow();
			TableCell _td = new TableCell();

			_tr.RenderBeginTag( writer );
			
			// apply CssClass for current element
			if( _element.TreeWeb.DefaultElementCssClass.Length > 0 )
				_td.CssClass = _element.TreeWeb.DefaultElementCssClass;
			if( _element.CssClass.Length > 0 )
				_td.CssClass = _element.CssClass;

			//_td.Style.Add( "display", "none" );
			_td.Attributes.Add( "nowrap", "yes" );
			_td.RenderBeginTag( writer );

			// render a &nbsp; at the begining of each element
			writer.Write( "&nbsp;" );

			// render element indentation based on element level
			string _indentation = "";
      int nIndentationPerStep = _element.TreeWeb.Indentation;
			for( int index = 0; index < (_element.Level * nIndentationPerStep); index++ )
				_indentation += _indentationStep;
			writer.Write( _indentation );

			// render the expand/collapse link if the element has child elements and is expandable.
			if( _element.HasElements )
			{
				HyperLink _link = new HyperLink();
				Image _image = new Image();

        if( _element.TreeWeb.Expandable && _element.Expandable )
        {
          if( _element.IsExpanded )
          {
            _link.Text = _expcol[1];
            if( _element.TreeWeb.ExpandedElementImage.Length > 0 )
              _image.ImageUrl = _element.TreeWeb.ExpandedElementImage;
          }
          else
          {
            _link.Text = _expcol[0];
            if( _element.TreeWeb.CollapsedElementImage.Length > 0 )
              _image.ImageUrl = _element.TreeWeb.CollapsedElementImage;
          }
        }

				string scriptCode = "javascript:";
				scriptCode += _element.TreeWeb.Page.GetPostBackEventReference( _element.TreeWeb, _element.ID );
				_link.NavigateUrl = scriptCode;

				if( _image.ImageUrl.Length > 0 )
				{
					_link.RenderBeginTag( writer );
					_image.RenderControl( writer );
					_link.RenderEndTag( writer );
				}
				else
					_link.RenderControl( writer );

				_image = null;
				_link = null;
				writer.Write( "&nbsp;" );
			}

			// render checkbox
			if( _element.TreeWeb.CheckBoxes || _element.CheckBox )
			{
				CheckBox _checkbox = new CheckBox();
				
				_checkbox.ID = _element.ID + TreeElement._separator + TreeElement._checkboxIDSufix;
				_checkbox.RenderControl( writer );

				_checkbox = null;
				
				// write a non-breaking space before the element text
				writer.Write( "&nbsp;" );
			}

			// render element's image if it has one
			if( _element.ImageIndex > -1 )
			{
				ElementImage _elementImage = _element.TreeWeb.ImageList[_element.ImageIndex];
				if( _elementImage != null )
				{
					Image _image = new Image();

					_image.ImageUrl = _elementImage.ImageUrl;
					_image.RenderControl( writer );

					_image = null;
//.........这里部分代码省略.........
开发者ID:dineshkummarc,项目名称:Portal-V2.8.1,代码行数:101,代码来源:TreeElementWriter.cs

示例2: RenderNodeCheckbox

        /// <summary>
        ///
        /// </summary>
        /// <param name="writer"></param>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// 	[jbrinkman]	5/6/2004	Created
        /// </history>
        protected void RenderNodeCheckbox( HtmlTextWriter writer )
        {
            if( _Node.DNNTree.CheckBoxes )
            {
                CheckBox _checkbox = new CheckBox();
                _checkbox.ID = _Node.ID + TreeNode._separator + TreeNode._checkboxIDSufix;
                _checkbox.Checked = _Node.Selected;
                string strJS = "";
                if( _Node.JSFunction.Length > 0 )
                {
                    if( _Node.JSFunction.EndsWith( ";" ) == false )
                    {
                        _Node.JSFunction += ";";
                    }
                    strJS += _Node.JSFunction;
                }
                if( _Node.DNNTree.JSFunction.Length > 0 )
                {
                    if( _Node.DNNTree.JSFunction.EndsWith( ";" ) == false )
                    {
                        _Node.DNNTree.JSFunction += ";";
                    }
                    strJS += _Node.DNNTree.JSFunction;
                }

                string strClick = ClientAPI.GetPostBackClientHyperlink( _Node.DNNTree, _Node.ID + ClientAPI.COLUMN_DELIMITER + "Click" ).Replace( "javascript:", "" ) + ";";
                string strCheck = ClientAPI.GetPostBackClientHyperlink( _Node.DNNTree, _Node.ID + ClientAPI.COLUMN_DELIMITER + "Checked" ).Replace( "javascript:", "" ) + ";";
                if( _Node.Selected == false )
                {
                    if( strJS.Length > 0 )
                    {
                        strJS = "if (eval(\"" + strJS.Replace( "\"", "\"\"" ) + "\") != false) ";
                        strJS += strClick + " else " + strCheck;
                    }
                    else
                    {
                        strJS += strClick;
                    }
                }
                else
                {
                    strJS = strCheck;
                }

                //_checkbox.Attributes.Add("onclick", ClientAPI.GetPostBackClientHyperlink(_Node.DNNTree, _Node.ID & ",Unchecked"))
                //Else
                _checkbox.Attributes.Add( "onclick", strJS );
                //End If
                _checkbox.RenderControl( writer );
                _checkbox = null;
                writer.Write( "&nbsp;", null );
            }
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:62,代码来源:TreeNodeWriter.cs


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