本文整理汇总了C#中System.Web.UI.WebControls.Label.RenderControl方法的典型用法代码示例。如果您正苦于以下问题:C# Label.RenderControl方法的具体用法?C# Label.RenderControl怎么用?C# Label.RenderControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.Label
的用法示例。
在下文中一共展示了Label.RenderControl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDesignTimeHtml
/// -----------------------------------------------------------------------------
/// <summary>
/// This class allows us to render the design time mode with custom HTML
/// </summary>
/// <remarks>
/// </remarks>
/// <history>
/// [Jon Henning] 9/20/2006 Commented
/// </history>
/// -----------------------------------------------------------------------------
public override string GetDesignTimeHtml()
{
string strText;
DNNToolBar objToolbar = (DNNToolBar)base.Component;
StringWriter sw = new StringWriter();
HtmlTextWriter tw = new HtmlTextWriter(sw);
Label objLabel;
Label objPanelTB;
objPanelTB = new Label();
//objPanelTB.Text = "[" & objToolbar.Target & " toolbar]"
if (!String.IsNullOrEmpty(objToolbar.CssClass)) objPanelTB.CssClass = objToolbar.CssClass;
foreach (DNNToolBarButton objBtn in objToolbar.Buttons) {
objLabel = new Label();
if (!String.IsNullOrEmpty(objBtn.CssClass)) objLabel.CssClass = objBtn.CssClass;
if (!String.IsNullOrEmpty(objBtn.Text)) objLabel.Text = objBtn.Text;
objPanelTB.Controls.Add(objLabel);
}
objPanelTB.Style.Add("position", "");
objPanelTB.Style.Add("top", "0px");
objPanelTB.Style.Add("left", "0px");
objPanelTB.RenderControl(tw);
return sw.ToString();
return strText;
}
示例2: GetDesignTimeHtml
//--- This class allows us to render the design time mode with custom HTML ---'
public override string GetDesignTimeHtml()
{
// Component is the instance of the component or control that
// this designer object is associated with. This property is
// inherited from System.ComponentModel.ComponentDesigner.
DNNMenu objMenu = (DNNMenu)Component;
if (objMenu.ID.Length > 0)
{
StringWriter sw = new StringWriter();
HtmlTextWriter tw = new HtmlTextWriter(sw);
Label objText = new Label();
objText.CssClass = objMenu.MenuBarCssClass + " " + objMenu.DefaultNodeCssClass;
objText.Text = objMenu.ID;
if (objMenu.Orientation == Orientation.Horizontal)
{
objText.Width = new Unit("100%");
}
//objText.Height = New Unit(objMenu)
else
{
objText.Height = new Unit(500);
//---not sure why 100% doesn't work here ---' 'Unit("100%")
//objText.Width = Unit.Empty
}
objText.RenderControl(tw);
return sw.ToString();
}
else
{
return null;
}
}
示例3: RenderControl
public override void RenderControl(System.Web.UI.HtmlTextWriter writer)
{
base.RenderControl(writer);
if (State == ControlState.Designtime || State == ControlState.Preview)
{
InternalHiddenField l = new InternalHiddenField();
l.ID = this.ControlID + "_textboxInternal";
l.RenderControl(writer);
Label label = new Label();
label.Text = "Keypress event placeholder";
label.RenderControl(writer);
}
}
示例4: BrnExportar_Click
/*Exporta el archivo a excel*/
protected void BrnExportar_Click(object sender, EventArgs e)
{
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=Proy_x.xls");
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite =
new HtmlTextWriter(stringWrite);
Label lbla = new Label();
lbla.Text = "PRESUPUESTO: " + DropDownList1.SelectedItem.Text;
lbla.ForeColor =Color.Red;
lbla.Font.Name = "Calibri";
lbla.Font.Size = 18;
lbla.RenderControl(htmlWrite);
Label lblcap = new Label();
lblcap.Text = "CAPITULOS";
lblcap.ForeColor = Color.Red;
lblcap.Font.Name = "Calibri";
lblcap.Font.Size = 14;
Label lblblanco = new Label();
lblblanco.Text = "";
lblblanco.RenderControl(htmlWrite);
htmlWrite.Write("</br>");
// lblcap.RenderControl(htmlWrite);
GridView1.RenderControl(htmlWrite);
Label lblunit = new Label();
lblunit.Text = "UNITARIOS";
lblunit.ForeColor = Color.Red;
lblunit.Font.Name = "Calibri";
lblunit.Font.Size = 14;
lblunit.RenderControl(htmlWrite);
GridView2.RenderControl(htmlWrite);
Label lblinsu = new Label();
lblinsu.Text = "INSUMOS";
lblinsu.ForeColor = Color.Red;
lblinsu.Font.Name = "Calibri";
lblinsu.Font.Size = 14;
lblinsu.RenderControl(htmlWrite);
GridView3.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}
示例5: AddPrevalueRow
/// <summary>
/// Adds a new row to the Prevalue Editor, (with an optional description).
/// </summary>
/// <param name = "writer">The HtmlTextWriter.</param>
/// <param name = "label">The label for the field.</param>
/// <param name = "description">The description for the field.</param>
/// <param name = "controls">The controls for the field.</param>
public static void AddPrevalueRow(this HtmlTextWriter writer, string label, string description, params Control[] controls)
{
writer.AddAttribute(HtmlTextWriterAttribute.Class, "row clearfix");
writer.RenderBeginTag(HtmlTextWriterTag.Div); // start 'row'
writer.AddAttribute(HtmlTextWriterAttribute.Class, "label");
writer.RenderBeginTag(HtmlTextWriterTag.Div); // start 'label'
var lbl = new Label { Text = label }; // TODO: Is it possible to include 'AssociatedControlID'?
lbl.RenderControl(writer);
writer.RenderEndTag(); // end 'label'
writer.AddAttribute(HtmlTextWriterAttribute.Class, "field");
writer.RenderBeginTag(HtmlTextWriterTag.Div); // start 'field'
foreach (Control control in controls)
{
control.RenderControl(writer);
}
writer.RenderEndTag(); // end 'field'
if (!string.IsNullOrEmpty(description))
{
writer.AddAttribute(HtmlTextWriterAttribute.Class, "description");
writer.RenderBeginTag(HtmlTextWriterTag.Div); // start 'description'
var desc = new Label { Text = description };
desc.RenderControl(writer);
writer.RenderEndTag(); // end 'description'
}
writer.RenderEndTag(); // end 'row'
}
示例6: RenderContents
protected override void RenderContents(HtmlTextWriter output)
{
if (!string.IsNullOrEmpty(_timePickerXml.Label.Text))
{
Label lbl = new Label();
lbl.ID = string.Format("lbl{0}", _timePickerXml.Name);
lbl.Text = _timePickerXml.Label.Text;
if (!string.IsNullOrEmpty(_timePickerXml.Label.Css))
lbl.CssClass = _timePickerXml.Label.Css;
if (!string.IsNullOrEmpty(_timePickerXml.Label.Style))
{
string[] styles = _timePickerXml.Label.Style.Split(';');
foreach (string style in styles)
{
string[] attributes = style.Split(':');
if (attributes.Length == 2)
lbl.Style.Add(attributes[0], attributes[1]);
}
}
lbl.RenderControl(output);
}
if (!string.IsNullOrEmpty(_timePickerXml.Css))
{
this._textBox.CssClass = _timePickerXml.Css;
}
if (!string.IsNullOrEmpty(_timePickerXml.Style))
{
string[] styles = _timePickerXml.Style.Split(';');
foreach (string style in styles)
{
string[] attributes = style.Split(':');
if (attributes.Length == 2)
this._textBox.Style.Add(attributes[0], attributes[1]);
}
}
base.RenderContents(output);
output.WriteBreak();
}
示例7: Render
// -------------------------------------------------------------------------------------
/// <summary>
/// Render this control to the output parameter specified.
/// </summary>
/// <param name="output"> The HTML writer to write out to </param>
// -------------------------------------------------------------------------------------
protected override void Render(HtmlTextWriter output)
{
if (!Page.ClientScript.IsStartupScriptRegistered("radio2"))
{
Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "radio2", "function test3(){}");
}
if (m_Question == null)
{
output.Write("Set question properties");
return;
}
// --- Render text controls
if (m_ControlState == ControlState.ReadOnly)
{
Literal answer = new Literal();
string delimStr = "|";
char[] delimiter = delimStr.ToCharArray();
string[] answArr = m_Question.Answer.ToString().Split(delimiter);
foreach (QuestionListItem item in m_Question.QuestionItemList)
{
if (CheckAnswer(answArr, item.ItemName))
{
answer.Text = answer.Text + "<li><b>" + item.ItemName + "</b><br>";
}
else
{
answer.Text = answer.Text + "<li>" + item.ItemName + "<br>";
}
}
answer.RenderControl(output);
}
else
{
//validation
string mandatory = string.Empty;
string validationError = string.Empty;
if ((m_Question.QuestionConstraint != null) && (m_Question.QuestionConstraint.Mandatory))
{
mandatory = "!";
}
if (ValidationSummary != string.Empty)
{
validationError = "*";
}
string validationText =
string.Format(" {0} {1} ", mandatory, validationError);
Label validation = new Label();
validation.CssClass = "ValidationSummary";
validation.Text = validationText;
validation.RenderControl(output);
// delegate the actual rendering to baseclass
base.Render(output);
}
}
示例8: Render
protected override void Render(HtmlTextWriter writer)
{
if (DesignMode || ShowEditMode)
{
base.ToolTip = BindingMember;
base.Render(writer);
}
else
{
if (TextMode == TextBoxMode.MultiLine)
{
var lit = new Literal();
lit.ID = this.ClientID;
lit.Text = Util.SafeFormat(Text);
lit.RenderControl(writer);
}
else
{
var lab = new Label();
lab.ID = this.ClientID;
lab.Text = Text;
lab.ToolTip = BindingMember;
lab.RenderControl(writer);
}
}
}
示例9: RenderTransformerConfigurationHeader
private void RenderTransformerConfigurationHeader(HtmlTextWriter writer) {
Debug.Assert(_pendingTransformer != null);
if (EnsurePendingData()) {
Debug.Assert(_pendingConsumer != null && _pendingProvider != null
&& _pendingConsumerConnectionPoint != null
&& _pendingProviderConnectionPoint != null);
string connectionPointName = null;
string partTitle = null;
bool isConsumer = (_pendingConsumer == WebPartToConnect);
if (_pendingConnectionType == ConnectionType.Consumer && isConsumer) {
// This happens if we are in a consumer, connecting or reconnecting a provider
partTitle = _pendingProvider.DisplayTitle;
connectionPointName = _pendingConsumerConnectionPoint.DisplayName;
}
else {
// This happens if we are reconnecting a consumer from a provider
partTitle = _pendingConsumer.DisplayTitle;
connectionPointName = _pendingProviderConnectionPoint.DisplayName;
}
Label label = new Label();
label.Page = Page;
label.ApplyStyle(LabelStyle);
label.Text = (isConsumer ? ConnectToProviderTitle : ConnectToConsumerTitle);
label.RenderControl(writer);
writer.WriteBreak();
writer.WriteBreak();
label.ApplyStyle(InstructionTextStyle);
label.Text = (isConsumer ? ConnectToProviderInstructionText : ConnectToConsumerInstructionText);
label.RenderControl(writer);
writer.WriteBreak();
writer.WriteBreak();
writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
writer.RenderBeginTag(HtmlTextWriterTag.Table);
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
label.ApplyStyle(LabelStyle);
label.Text = (isConsumer ? GetText : SendText);
label.RenderControl(writer);
writer.RenderEndTag(); // TD
LabelStyle.AddAttributesToRender(writer, this);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.WriteEncodedText(connectionPointName);
writer.RenderEndTag(); // TD
writer.RenderEndTag(); // TR
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
label.Text = (isConsumer ? GetFromText : SendToText);
label.RenderControl(writer);
writer.RenderEndTag(); // TD
LabelStyle.AddAttributesToRender(writer, this);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.WriteEncodedText(partTitle);
writer.RenderEndTag(); // TD
writer.RenderEndTag(); // TR
writer.RenderEndTag(); // TABLE
writer.WriteBreak();
writer.RenderBeginTag(HtmlTextWriterTag.Hr);
writer.RenderEndTag(); // HR
writer.WriteBreak();
label.ApplyStyle(LabelStyle);
label.Text = ConfigureConnectionTitle;
label.RenderControl(writer);
writer.WriteBreak();
writer.WriteBreak();
}
}
示例10: RenderExistingConnection
private void RenderExistingConnection(HtmlTextWriter writer,
string connectionPointName,
string partTitle,
string disconnectEventArg,
string editEventArg,
bool consumer,
bool isActive) {
Label label = new Label();
label.Page = Page;
label.ApplyStyle(LabelStyle);
writer.RenderBeginTag(HtmlTextWriterTag.Fieldset);
writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
writer.RenderBeginTag(HtmlTextWriterTag.Table);
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
label.Text = (consumer ? SendText : GetText);
label.RenderControl(writer);
writer.RenderEndTag(); // TD
LabelStyle.AddAttributesToRender(writer, this);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.WriteEncodedText(connectionPointName);
writer.RenderEndTag(); // TD
writer.RenderEndTag(); // TR
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
label.Text = (consumer ? SendToText : GetFromText);
label.RenderControl(writer);
writer.RenderEndTag(); // TD
LabelStyle.AddAttributesToRender(writer, this);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.WriteEncodedText(partTitle);
writer.RenderEndTag(); // TD
writer.RenderEndTag(); // TR
writer.RenderEndTag(); // TABLE
WebPartVerb disconnectVerb = DisconnectVerb;
disconnectVerb.EventArgument = disconnectEventArg;
RenderVerb(writer, disconnectVerb);
if (VerbButtonType == ButtonType.Link) {
writer.Write(" ");
}
if (isActive) {
WebPartVerb configureVerb = ConfigureVerb;
if (editEventArg == null) {
configureVerb.Enabled = false;
}
else {
configureVerb.Enabled = true;
configureVerb.EventArgument = editEventArg;
}
RenderVerb(writer, configureVerb);
}
else {
writer.WriteBreak();
label.ApplyStyle(ErrorStyle);
label.Text = ExistingConnectionErrorMessage;
label.RenderControl(writer);
}
writer.RenderEndTag(); // FIELDSET
}
示例11: RenderInstructionTitle
private void RenderInstructionTitle(HtmlTextWriter writer) {
if (this.PartChromeType == PartChromeType.None ||
this.PartChromeType == PartChromeType.BorderOnly)
return;
string instructionTitle = InstructionTitle;
if (!String.IsNullOrEmpty(instructionTitle)) {
Label label = new Label();
if (WebPartToConnect != null) {
label.Text = String.Format(CultureInfo.CurrentCulture, instructionTitle, WebPartToConnect.DisplayTitle);
}
else {
label.Text = instructionTitle;
}
label.Page = Page;
label.ApplyStyle(LabelStyle);
label.RenderControl(writer);
writer.WriteBreak();
}
}
示例12: RenderInstructionTitle
private void RenderInstructionTitle(HtmlTextWriter writer)
{
if ((this.PartChromeType != System.Web.UI.WebControls.WebParts.PartChromeType.None) && (this.PartChromeType != System.Web.UI.WebControls.WebParts.PartChromeType.BorderOnly))
{
string instructionTitle = this.InstructionTitle;
if (!string.IsNullOrEmpty(instructionTitle))
{
Label label = new Label();
if (this.WebPartToConnect != null)
{
label.Text = string.Format(CultureInfo.CurrentCulture, instructionTitle, new object[] { this.WebPartToConnect.DisplayTitle });
}
else
{
label.Text = instructionTitle;
}
label.Page = this.Page;
label.ApplyStyle(base.LabelStyle);
label.RenderControl(writer);
writer.WriteBreak();
}
}
}
示例13: RenderNoExistingConnection
private void RenderNoExistingConnection(HtmlTextWriter writer)
{
string noExistingConnectionTitle = this.NoExistingConnectionTitle;
if (!string.IsNullOrEmpty(noExistingConnectionTitle))
{
Label label = new Label {
Text = noExistingConnectionTitle,
Page = this.Page
};
label.ApplyStyle(base.LabelStyle);
label.RenderControl(writer);
writer.WriteBreak();
writer.WriteBreak();
}
string noExistingConnectionInstructionText = this.NoExistingConnectionInstructionText;
if (!string.IsNullOrEmpty(noExistingConnectionInstructionText))
{
Label label2 = new Label {
Text = noExistingConnectionInstructionText,
Page = this.Page
};
label2.ApplyStyle(base.InstructionTextStyle);
label2.RenderControl(writer);
writer.WriteBreak();
writer.WriteBreak();
}
}
示例14: RenderExistingConnections
private void RenderExistingConnections(HtmlTextWriter writer)
{
WebPartManager webPartManager = base.WebPartManager;
bool flag = false;
bool flag2 = false;
bool flag3 = false;
if (webPartManager != null)
{
WebPart webPartToConnect = this.WebPartToConnect;
WebPartConnectionCollection connections = webPartManager.Connections;
foreach (WebPartConnection connection in connections)
{
if (connection.Provider == webPartToConnect)
{
if (!flag)
{
this.RenderInstructionTitle(writer);
this.RenderInstructionText(writer);
flag = true;
}
if (!flag2)
{
writer.RenderBeginTag(HtmlTextWriterTag.Fieldset);
base.LabelStyle.AddAttributesToRender(writer, this);
writer.RenderBeginTag(HtmlTextWriterTag.Legend);
writer.Write(this.ConsumersTitle);
writer.RenderEndTag();
string consumersInstructionText = this.ConsumersInstructionText;
if (!string.IsNullOrEmpty(consumersInstructionText))
{
writer.WriteBreak();
Label label = new Label {
Text = consumersInstructionText,
Page = this.Page
};
label.ApplyStyle(base.InstructionTextStyle);
label.RenderControl(writer);
writer.WriteBreak();
}
flag2 = true;
}
this.RenderExistingConsumerConnection(writer, connection);
}
}
if (flag2)
{
writer.RenderEndTag();
}
foreach (WebPartConnection connection2 in connections)
{
if (connection2.Consumer == webPartToConnect)
{
if (!flag)
{
this.RenderInstructionTitle(writer);
this.RenderInstructionText(writer);
flag = true;
}
if (!flag3)
{
writer.RenderBeginTag(HtmlTextWriterTag.Fieldset);
base.LabelStyle.AddAttributesToRender(writer, this);
writer.RenderBeginTag(HtmlTextWriterTag.Legend);
writer.Write(this.ProvidersTitle);
writer.RenderEndTag();
string providersInstructionText = this.ProvidersInstructionText;
if (!string.IsNullOrEmpty(providersInstructionText))
{
writer.WriteBreak();
Label label2 = new Label {
Text = providersInstructionText,
Page = this.Page
};
label2.ApplyStyle(base.InstructionTextStyle);
label2.RenderControl(writer);
writer.WriteBreak();
}
flag3 = true;
}
this.RenderExistingProviderConnection(writer, connection2);
}
}
}
if (flag3)
{
writer.RenderEndTag();
}
if (flag)
{
writer.WriteBreak();
}
else
{
this.RenderNoExistingConnection(writer);
}
}
示例15: RenderInstructionText
private void RenderInstructionText(HtmlTextWriter writer)
{
string instructionText = this.InstructionText;
if (!string.IsNullOrEmpty(instructionText))
{
Label label = new Label {
Text = instructionText,
Page = this.Page
};
label.ApplyStyle(base.InstructionTextStyle);
label.RenderControl(writer);
writer.WriteBreak();
writer.WriteBreak();
}
}