本文整理汇总了C#中System.Web.UI.WebControls.TextBox.RenderControl方法的典型用法代码示例。如果您正苦于以下问题:C# TextBox.RenderControl方法的具体用法?C# TextBox.RenderControl怎么用?C# TextBox.RenderControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.TextBox
的用法示例。
在下文中一共展示了TextBox.RenderControl方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
//"SelectTagsPanel", "/sitecore/shell/Applications/Taxonomy/Ribbon/SelectTagsPanel.js"
//ScriptFile tagsBoxScript = new ScriptFile();
//tagsBoxScript.Type = "text/javascript";
//tagsBoxScript.Key = Control.GetUniqueID("TagsBoxScript");
//tagsBoxScript.Src = "/sitecore/shell/Applications/Taxonomy/Ribbon/SelectTagsPanel.js";
//var currentScriptManager = AjaxScriptManager.Current;
//if (currentScriptManager!=null)
//{
// currentScriptManager.PageScriptManager.ScriptFiles.Add(tagsBoxScript);
//}
//else
//{
// Sitecore.Context.ClientPage.PageScriptManager.ScriptFiles.Add(tagsBoxScript);
//}
//writer.WriteBeginTag("script");
//writer.WriteAttribute("type","text/javascript");
//writer.WriteAttribute("key", "TagsBoxScript");
//writer.WriteAttribute("src", "/sitecore/shell/Applications/Taxonomy/Ribbon/SelectTagsPanel.js");
//writer.WriteEndTag("script");
//writer.Write(
// "<script type=\"text/javascript\" key=\"TagsBoxScript\" src=\"/sitecore/shell/Applications/Taxonomy/Ribbon/SelectTagsPanel.js\"></script>");
writer.Write(
"<script type=\"text/javascript\" key=\"TagsBoxScript\">function Tags_KeyPressed() {alert('test');}</script>");
TextBox tagsBox = new TextBox
{ TextMode = TextBoxMode.MultiLine, Width = Unit.Pixel(500), Height = Unit.Pixel(38) };
tagsBox.Attributes.Add("onKeyPress", "Tags_KeyPressed();");
tagsBox.RenderControl(writer);
base.Render(writer);
}
示例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.
DNNTextSuggest objTextSuggest = (DNNTextSuggest)Component;
if (objTextSuggest.ID.Length > 0)
{
StringWriter sw = new StringWriter();
HtmlTextWriter tw = new HtmlTextWriter(sw);
TextBox objText = new TextBox();
objText.Text = objTextSuggest.Text;
objText.RenderControl(tw);
return sw.ToString();
}
else
{
return null;
}
}
示例3: RenderRow
private void RenderRow(HtmlTextWriter writer, string label, TextBox textBox, BaseValidator validator1, BaseValidator validator2)
{
// Row
writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
// Label
writer.AddAttribute(HtmlTextWriterAttribute.Wrap, "false");
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.RenderBeginTag(HtmlTextWriterTag.B);
writer.Write(string.Format("{0} ", label));
writer.RenderEndTag(); // B
writer.RenderEndTag(); // Td
// Text box
writer.AddAttribute(HtmlTextWriterAttribute.Wrap, "false");
writer.RenderBeginTag(HtmlTextWriterTag.Td);
textBox.RenderControl(writer);
writer.RenderEndTag(); // Td
// Gap
writer.AddAttribute(HtmlTextWriterAttribute.Wrap, "false");
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.Write(" ");
writer.RenderEndTag(); // Td
// Validator
writer.AddAttribute(HtmlTextWriterAttribute.Wrap, "false");
writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
writer.RenderBeginTag(HtmlTextWriterTag.Td);
validator1.RenderControl(writer);
if (validator2 != null)
validator2.RenderControl(writer);
writer.RenderEndTag(); // Td
// Close out row
writer.RenderEndTag(); // Tr
}
示例4: Render
/// <summary>
/// Renderメソッドは、
/// ・RenderBeginTag(開始のタグ)
/// ・RenderContents(中間の部分)
/// ・RenderEndTag(終了のタグ)
/// の各メソッドをこの順に呼び出して、
/// コントロールをクライアントに送信する。
/// </summary>
/// <param name="output">コントロールの内容を受け取る HtmlTextWriter のオブジェクト</param>
/// <remarks>
/// このメソッドは、表示中にページによって自動的に呼び出される。
/// また、このメソッドは、主にコントロールの開発者によって使用される。
///
/// WebControl.Renderメソッド
/// http://msdn.microsoft.com/ja-jp/library/system.web.ui.webcontrols.webcontrol.render.aspx
/// </remarks>
protected override void Render(HtmlTextWriter output)
{
// Render処理を作り込む。
//if (false)
//{
// // Renderxの順次呼び出し
// // ・RenderBeginTag(開始のタグ)
// // ・RenderContents(中間の部分)
// // ・RenderEndTag(終了のタグ)
// // 独自にWriteでも良い。
// output.Write("xxxx");
//}
//else
//{
// // 通常通りのRender
// base.Render(output);
//}
// Creating a Read Only DropDownList - CodeProject
// http://www.codeproject.com/Articles/26642/Creating-a-Read-Only-DropDownList
// cpol Code Project Open License - CodeProject
// http://www.codeproject.com/info/cpol10.aspx
if (this.ReadOnly)
{
// 出力をテキスト・ボックスに変換。
TextBox tb = new TextBox();
tb.Text = this.SelectedItem.Text;
tb.ReadOnly = true;
// 色は要カスタマイズ。
tb.BackColor = Color.LightGray;
// テキスト・ボックスのレンダーに変換。
tb.RenderControl(output);
}
else
{
base.Render(output);
}
}
示例5: GetDesignTimeHtml
/// <summary>
///
/// </summary>
/// <returns></returns>
public override string GetDesignTimeHtml()
{
StringWriter sw = new StringWriter();
HtmlTextWriter tw = new HtmlTextWriter(sw);
TextBox tb = new TextBox();
tb.BackColor = System.Drawing.Color.LightSeaGreen;
tb.RenderControl(tw);
return sw.ToString();
}
示例6: GetDesignTimeHtml
public override string GetDesignTimeHtml()
{
StringWriter sw = new StringWriter();
HtmlTextWriter tw = new HtmlTextWriter(sw);
TextBox tb = new TextBox();
tb.Text = "RangeBox";
tb.ControlStyle.BackColor = System.Drawing.Color.Red;
tb.RenderControl(tw);
return sw.ToString();
}
示例7: Render
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
try
{
if (Utility.HtmlIsHidden(HideFromAgents))
return;
if (WriteCachedOuput(writer))
return;
if (string.IsNullOrEmpty(XslName))
{
Trace.WriteLine("No XSL name specified");
return;
}
if (XslName.ToLower() == "blank.xsl")
return;
if (Document == null)
{
Trace.WriteLine(CacheKey + ": Document is NULL...Unable to render");
return;
}
if (this.ShowXml)
{
TextBox showxml = new TextBox();
showxml.EnableViewState = false;
showxml.ID = this.UniqueID + "_showxml";
showxml.TextMode = TextBoxMode.MultiLine;
showxml.Wrap = true;
showxml.Rows = 10;
showxml.Columns = 30;
XmlDocument showXmlDoc = (XmlDocument)this.Document;
showxml.Text = showXmlDoc.InnerXml;
showxml.CssClass = "showxml";
showxml.RenderControl(writer);
}
else
{
XmlDocument oXsl = new XmlDocument();
object oXslTransform = null;
if (!SPContext.Current.Web.UserIsWebAdmin)
oXslTransform = HttpContext.Current.Cache[XslCacheKey];
XslCompiledTransform oTransform = null;
if (oXslTransform == null)
{
string sXSLLibrary = XslLibrary;
string sXslString = SPContext.Current.Site.RootWeb.GetFileAsString(sXSLLibrary + XslName);
oXsl.LoadXml(sXslString);
oTransform = new XslCompiledTransform();
oTransform.Load(oXsl);
HttpContext.Current.Cache.Add(XslCacheKey, oTransform, null,
DateTime.Now.AddMinutes(this.CacheDuration),
System.Web.Caching.Cache.NoSlidingExpiration,
System.Web.Caching.CacheItemPriority.AboveNormal, null);
}
else
oTransform = (XslCompiledTransform)oXslTransform;
if (CacheOutput)
TransformAndCache(writer, oTransform);
else
{
if (System.Configuration.ConfigurationManager.AppSettings["EncryptXSL"] != null && System.Configuration.ConfigurationManager.AppSettings["EncryptXSL"].ToString().Contains(XslName.ToLower()))
{
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter tw = new HtmlTextWriter(sw);
oTransform.Transform(Document, BuildArguments(), tw);
//Encrypt
string enc = Utility.EncryptText(sw.ToString());
writer.Write(enc);
}
else
{
oTransform.Transform(Document, BuildArguments(), writer);
}
}
}
}
catch (Exception ex)
{
Trace.WriteLine(XslCacheKey);
Trace.Write(ex);
}
base.Render(writer);
}
示例8: Render
protected override void Render(HtmlTextWriter writer)
{
#if !V2
bool DesignMode = this.Context == null;
#endif
if (!DesignMode)
{
Anthem.Manager.WriteBeginControlMarker(writer, "span", this);
}
if (Visible)
{
if (!DesignMode && _showTextbox)
{
// Non-IE browsers get a textbox for editing.
ASP.TextBox textbox = new ASP.TextBox();
textbox.ID = this.ClientID;
textbox.Text = Text;
textbox.ApplyStyle(GetStyle());
#if V2
textbox.EnableTheming = this.EnableTheming;
#endif
textbox.Attributes["onblur"] = string.Format("editLabelSave(this,{0},'{1}','{2}','{3}',{4},{5},{6},{7});",
"false",
string.Empty,
string.Empty,
this.TextDuringCallBack,
this.EnabledDuringCallBack ? "true" : "false",
this.PreCallBackFunction == null || this.PreCallBackFunction.Length == 0 ? "null" : this.PreCallBackFunction,
this.PostCallBackFunction == null || this.PostCallBackFunction.Length == 0 ? "null" : this.PostCallBackFunction,
this.CallBackCancelledFunction == null || this.CallBackCancelledFunction.Length == 0 ? "null" : this.CallBackCancelledFunction
);
textbox.Attributes["onkeypress"] = "return editLabelCheckKey(event);";
textbox.RenderControl(writer);
}
else
{
base.Render(writer);
}
}
if (!DesignMode)
{
Anthem.Manager.WriteEndControlMarker(writer, "span", this);
}
}
示例9: RenderContentsInternal
protected virtual void RenderContentsInternal(HtmlTextWriter writer, TextBox ctl, bool reenterPassword)
{
if (this.RenderMode == FieldControlRenderMode.InlineEdit)
{
var titleText = String.Concat(this.Field.DisplayName, " ", this.Field.Description);
ctl.Attributes.Add("Title", titleText);
}
if (this.Field.ReadOnly)
writer.Write(ctl.Text);
else if (this.ReadOnly)
{
ctl.Enabled = !this.ReadOnly;
ctl.EnableViewState = false;
ctl.RenderControl(writer);
}
else
ctl.RenderControl(writer);
}