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


C# LinkButton.RenderControl方法代码示例

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


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

示例1: RenderBaseControl

        /// <summary>
        /// This is where you implment the simple aspects of rendering your control.  The rest
        /// will be handled by calling RenderControlHelper's RenderControl() method.
        /// </summary>
        /// <param name="writer">The writer.</param>
        public virtual void RenderBaseControl( HtmlTextWriter writer )
        {
            if ( this.Enabled )
            {
                writer.AddAttribute( "id", this.ID.ToString() );
                writer.AddAttribute( "class", "picker picker-select rollover-container " + this.CssClass );
                writer.RenderBeginTag( HtmlTextWriterTag.Div );

                _hfItemId.RenderControl( writer );
                _hfInitialItemParentIds.RenderControl( writer );
                _hfItemName.RenderControl( writer );
                _hfItemRestUrlExtraParams.RenderControl( writer );

                if ( !HidePickerLabel )
                {
                    string pickerLabelHtmlFormat = @"
                    <a class='picker-label' href='#'>
                        <i class='{2}'></i>
                        <span id='selectedItemLabel_{0}' class='selected-names'>{1}</span>
                        <b class='fa fa-caret-down pull-right'></b>
                    </a>";

                    writer.Write( pickerLabelHtmlFormat, this.ID, this.ItemName, this.IconCssClass );

                    writer.WriteLine();

                    _btnSelectNone.RenderControl( writer );
                }

                // picker menu
                writer.AddAttribute( "class", "picker-menu dropdown-menu" );
                if ( ShowDropDown )
                {
                    writer.AddStyleAttribute( HtmlTextWriterStyle.Display, "block" );
                }

                writer.RenderBeginTag( HtmlTextWriterTag.Div );

                // mode panel
                if ( ModePanel != null )
                {
                    ModePanel.RenderControl( writer );
                }

                // treeview
                writer.Write(
                           @"<div id='treeview-scroll-container_{0}' class='scroll-container scroll-container-vertical scroll-container-picker'>
                                <div class='scrollbar'>
                                    <div class='track'>
                                        <div class='thumb'>
                                            <div class='end'></div>
                                        </div>
                                    </div>
                                </div>
                                <div class='viewport'>
                                    <div class='overview'>
                                        <div id='treeviewItems_{0}' class='treeview treeview-items'></div>        
                                    </div>
                                </div>
                            </div>",
                           this.ID );

                // picker actions
                writer.AddAttribute( "class", "picker-actions" );
                writer.RenderBeginTag( HtmlTextWriterTag.Div );
                _btnSelect.RenderControl( writer );
                writer.Write( "<a class='btn btn-xs btn-link picker-cancel' id='btnCancel_{0}'>Cancel</a>", this.ID );
                writer.WriteLine();
                writer.RenderEndTag();

                // closing div of picker-menu
                writer.RenderEndTag();

                // closing div of picker
                writer.RenderEndTag();

                RegisterJavaScript();
            }
            else
            {
                // this picker is not enabled (readonly), so just render a readonly version
                writer.AddAttribute( "class", "picker picker-select" );
                writer.RenderBeginTag( HtmlTextWriterTag.Div );
                LinkButton linkButton = new LinkButton();
                linkButton.CssClass = "picker-label";
                linkButton.Text = string.Format( "<i class='{1}'></i><span>{0}</span>", this.ItemName, this.IconCssClass );
                linkButton.Enabled = false;
                linkButton.RenderControl( writer );
                writer.WriteLine();
                writer.RenderEndTag();
            }
        }
开发者ID:jondhinkle,项目名称:Rock,代码行数:97,代码来源:ItemPicker.cs

示例2: RenderBaseControl

        /// <summary>
        /// Renders the <see cref="T:System.Web.UI.WebControls.TextBox" /> control to the specified <see cref="T:System.Web.UI.HtmlTextWriter" /> object.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> that receives the rendered output.</param>
        public void RenderBaseControl( HtmlTextWriter writer )
        {
            if ( this.Enabled )
            {
                writer.AddAttribute( "id", this.ClientID );
                writer.AddAttribute( "class", string.Format( "picker picker-select picker-person {0}", this.CssClass ) );
                writer.RenderBeginTag( HtmlTextWriterTag.Div );
                _hfPersonId.RenderControl( writer );
                _hfPersonName.RenderControl( writer );
                _hfSelfPersonId.RenderControl( writer );
                _hfSelfPersonName.RenderControl( writer );
                _hfIncludeBusinesses.RenderControl( writer );

                string pickerLabelHtmlFormat = @"
            <a class='picker-label' href='#'>
                <i class='fa fa-user'></i>
                <span id='{0}_selectedPersonLabel' class='picker-selectedperson'>{1}</span>
                <b class='fa fa-caret-down pull-right'></b>
            </a>
            ";
                writer.Write( string.Format( pickerLabelHtmlFormat, this.ClientID, this.PersonName ) );

                _btnSelectNone.RenderControl( writer );

                // render picker-menu dropdown-menu
                writer.AddAttribute( HtmlTextWriterAttribute.Class, "picker-menu dropdown-menu" );
                writer.RenderBeginTag( HtmlTextWriterTag.Div );

                writer.AddAttribute( HtmlTextWriterAttribute.Class, "row" );
                writer.RenderBeginTag( HtmlTextWriterTag.Div );

                // column1
                writer.AddAttribute( HtmlTextWriterAttribute.Class, "col-md-6" );
                writer.RenderBeginTag( HtmlTextWriterTag.Div );
                writer.Write( "<h4>Search</h4>" );
                writer.RenderEndTag();

                // column2
                writer.AddAttribute( HtmlTextWriterAttribute.Class, "col-md-6" );
                writer.RenderBeginTag( HtmlTextWriterTag.Div );
                if ( this.EnableSelfSelection )
                {
                    writer.Write( @"
                    <span class='js-select-self' title='Select self'>
                        <i class='fa fa-user pull-right clickable' ></i>
                    </span>" );
                }
                writer.RenderEndTag();

                // row
                writer.RenderEndTag();

                string pickMenuHtmlFormatStart = @"
             <input id='{0}_personPicker' type='text' class='picker-search form-control input-sm' />

             <hr />

             <h4>Results</h4>

             <ul class='picker-select' id='{0}_personPickerItems'>
             </ul>
             <div class='picker-actions'>
            ";

                writer.Write( pickMenuHtmlFormatStart, this.ClientID );

                _btnSelect.RenderControl( writer );

                string pickMenuHtmlFormatEnd = @"
            <a class='btn btn-link btn-xs' id='{0}_btnCancel'>Cancel</a>
            </div>
            ";

                writer.Write( string.Format( pickMenuHtmlFormatEnd, this.ClientID ) );

                // picker-menu dropdown-menu
                writer.RenderEndTag();

                // picker picker-select picker-person
                writer.RenderEndTag();
            }
            else
            {
                // this picker is not enabled (readonly), so just render a readonly version
                writer.AddAttribute( "class", "picker picker-select" );
                writer.RenderBeginTag( HtmlTextWriterTag.Div );
                LinkButton linkButton = new LinkButton();
                linkButton.CssClass = "picker-label";
                linkButton.Text = string.Format( "<i class='{1}'></i><span>{0}</span>", this.PersonName, "fa fa-user" );
                linkButton.Enabled = false;
                linkButton.RenderControl( writer );
                writer.WriteLine();
                writer.RenderEndTag();
            }
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:99,代码来源:PersonPicker.cs

示例3: RenderBaseControl

        /// <summary>
        /// Renders the <see cref="T:System.Web.UI.WebControls.TextBox" /> control to the specified <see cref="T:System.Web.UI.HtmlTextWriter" /> object.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> that receives the rendered output.</param>
        public void RenderBaseControl( HtmlTextWriter writer )
        {
            _hfPersonId.RenderControl( writer );
            _hfPersonName.RenderControl( writer );

            if ( this.Enabled )
            {
                string controlHtmlFormatStart = @"
        <div id='{0}' class='picker picker-select picker-person {2}' > 
            <a class='picker-label' href='#'>
                <i class='fa fa-user'></i>
                <span id='selectedPersonLabel_{0}'>{1}</span>
                <b class='fa fa-caret-down pull-right'></b>
            </a>
";
                writer.Write( string.Format( controlHtmlFormatStart, this.ID, this.PersonName, this.CssClass ) );

                _btnSelectNone.RenderControl( writer );

                string controlHtmlFormatMiddle = @"
          <div class='picker-menu dropdown-menu'>

             <h4>Search</h4>
             <input id='personPicker_{0}' type='text' class='picker-search form-control input-sm' />

             <hr />             

             <h4>Results</h4>
             
             <ul class='picker-select' id='personPickerItems_{0}'>
             </ul>
             <div class='picker-actions'>
";

                writer.Write( controlHtmlFormatMiddle, this.ID, this.PersonName );

                _btnSelect.RenderControl( writer );

                string controlHtmlFormatEnd = @"
            <a class='btn btn-link btn-xs' id='btnCancel_{0}'>Cancel</a>
            </div>
         </div>
     </div>
";

                writer.Write( string.Format( controlHtmlFormatEnd, this.ID, this.PersonName ) );
            }
            else
            {
                // this picker is not enabled (readonly), so just render a readonly version
                writer.AddAttribute( "class", "picker picker-select" );
                writer.RenderBeginTag( HtmlTextWriterTag.Div );
                LinkButton linkButton = new LinkButton();
                linkButton.CssClass = "picker-label";
                linkButton.Text = string.Format( "<i class='{1}'></i><span>{0}</span>", this.PersonName, "fa fa-user" );
                linkButton.Enabled = false;
                linkButton.RenderControl( writer );
                writer.WriteLine();
                writer.RenderEndTag();
            }
        }
开发者ID:pkdevbox,项目名称:Rock,代码行数:65,代码来源:PersonPicker.cs

示例4: RenderEventRow

        protected void RenderEventRow(HtmlTextWriter writer, DateTime rowStart)
        {
            DateTime rowEnd = rowStart.Date.AddDays(6);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "events");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            CalendarEvent[] events = this._provider.GetEvents(this.DisplayUserKey, rowStart.Date, rowEnd.Date);
            if (events.Length == 0)
            {
                for (int i = 0; i < 7; i++)
                    this.RenderEmptyEvent(writer);
            }
            else
            {
                Style eventTextStyle = new Style();
                eventTextStyle.MergeWith(this._eventStyle);
                eventTextStyle.BorderStyle = BorderStyle.None;

                List<CalendarEvent> unrenderedEvents = new List<CalendarEvent>(events);
                DateTime curDay = rowStart;
                while (unrenderedEvents.Count > 0)
                {
                    // Doing the event this way, lets us put multiple events on the same
                    //   row, so long as they don't "interfere" with each other.
                    CalendarEvent curEv = null;
                    if (curDay.Date == rowStart.Date)
                        // Make sure that we only allow events to occured before the
                        //   "current" date if we're on the first cell in the row.
                        curEv = unrenderedEvents.Where(e => e.EventStartDate.Date <= curDay.Date).FirstOrDefault();
                    else
                        curEv = unrenderedEvents.Where(e => e.EventStartDate.Date == curDay.Date).FirstOrDefault();

                    while (curEv == null && curDay.Date <= rowEnd.Date)
                    {
                        this.RenderEmptyEvent(writer);
                        curDay = curDay.AddDays(1);
                        curEv = unrenderedEvents.Where(e => e.EventStartDate.Date == curDay.Date).FirstOrDefault();
                    }

                    if (curEv == null)
                    {
                        // If we still have no current event at this point, end this row,
                        //   start a new one, and let the search start over.
                        curDay = rowStart;
                        writer.RenderEndTag(); // TR (event row)
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, "events");
                        writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                    }
                    else
                    {
                        // Now, we write the actual event.
                        int eventDays = curEv.EventEndDate.Date <= rowEnd.Date
                            ? (int)System.Math.Ceiling(curEv.EventEndDate.Subtract(curDay).TotalDays)
                            : (int)System.Math.Ceiling(rowEnd.Subtract(curDay).TotalDays) + 1;
                        if (eventDays > 1)
                            writer.AddAttribute(HtmlTextWriterAttribute.Colspan, eventDays.ToString());
                        if (curEv.EventStartDate < rowStart && curEv.EventEndDate > rowEnd)
                            writer.AddAttribute(HtmlTextWriterAttribute.Class, "evMid");
                        else if (curEv.EventStartDate < rowStart)
                            writer.AddAttribute(HtmlTextWriterAttribute.Class, "evEnd");
                        else if (curEv.EventEndDate > rowEnd)
                            writer.AddAttribute(HtmlTextWriterAttribute.Class, "evStart");
                        else
                            writer.AddAttribute(HtmlTextWriterAttribute.Class, "evFull");
                        if (this.ControlStyle != null)
                        {
                            System.Web.UI.WebControls.Style tdStyle = new Style();
                            tdStyle.BorderStyle = this.ControlStyle.BorderStyle;
                            tdStyle.BorderColor = this.ControlStyle.BorderColor;
                            tdStyle.BorderWidth = this.ControlStyle.BorderWidth;
                            tdStyle.ForeColor = this.ControlStyle.ForeColor;
                            tdStyle.BackColor = this.ControlStyle.BackColor;
                            tdStyle.AddAttributesToRender(writer);
                        }
                        writer.RenderBeginTag(HtmlTextWriterTag.Td);

                        //if (curEv.EventStartDate < rowStart && curEv.EventEndDate > rowEnd)
                        //    writer.AddAttribute(HtmlTextWriterAttribute.Class, "evMid");
                        //else if (curEv.EventStartDate < rowStart)
                        //    writer.AddAttribute(HtmlTextWriterAttribute.Class, "evEnd");
                        //else if (curEv.EventEndDate > rowEnd)
                        //    writer.AddAttribute(HtmlTextWriterAttribute.Class, "evStart");
                        //else
                        //    writer.AddAttribute(HtmlTextWriterAttribute.Class, "evFull");
                        this._eventStyle.AddAttributesToRender(writer);
                        writer.RenderBeginTag(HtmlTextWriterTag.Div);

                        LinkButton lnkEvent = new LinkButton();
                        lnkEvent.ID = "lnkEvent_" + curEv.ProviderEventKey + "_" + curDay.ToString("yyyyMMdd");
                        lnkEvent.Text = (curEv.EventStartDate.Date == curDay.Date)
                            ? string.Format("{0} {1}", curEv.EventStartDate.ToString(System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortTimePattern), curEv.Subject)
                            : string.Format("<< {0}", curEv.Subject);
                        lnkEvent.ApplyStyle(eventTextStyle);
                        lnkEvent.CommandName = "ShowEvent";
                        lnkEvent.CommandArgument = curEv.ProviderEventKey.ToString();
                        lnkEvent.Command += new CommandEventHandler(this.lnkEvent_Command);

                        this.Controls.Add(lnkEvent);
                        lnkEvent.RenderControl(writer);
//.........这里部分代码省略.........
开发者ID:tenshino,项目名称:RainstormStudios,代码行数:101,代码来源:CalendarView.cs


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