本文整理汇总了C#中System.Web.UI.WebControls.HyperLink.RenderEndTag方法的典型用法代码示例。如果您正苦于以下问题:C# HyperLink.RenderEndTag方法的具体用法?C# HyperLink.RenderEndTag怎么用?C# HyperLink.RenderEndTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.HyperLink
的用法示例。
在下文中一共展示了HyperLink.RenderEndTag方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDesignTimeHtml
public override string GetDesignTimeHtml()
{
AdRotator viewControl = (AdRotator) base.ViewControl;
StringWriter writer = new StringWriter(CultureInfo.CurrentCulture);
DesignTimeHtmlTextWriter writer2 = new DesignTimeHtmlTextWriter(writer);
HyperLink link = new HyperLink {
ID = viewControl.ID,
NavigateUrl = "",
Target = viewControl.Target,
AccessKey = viewControl.AccessKey,
Enabled = viewControl.Enabled,
TabIndex = viewControl.TabIndex
};
link.Style.Value = viewControl.Style.Value;
link.RenderBeginTag(writer2);
Image image = new Image();
image.ApplyStyle(viewControl.ControlStyle);
image.SetDesignMode();
image.ImageUrl = "";
image.AlternateText = viewControl.ID;
image.ToolTip = viewControl.ToolTip;
image.RenderControl(writer2);
link.RenderEndTag(writer2);
return writer.ToString();
}
示例2: Render
protected override void Render (HtmlTextWriter writer)
{
HyperLink hLink = new HyperLink ();
Image adImage = new Image();
foreach (string current in Attributes.Keys)
hLink.Attributes [current] = Attributes [current];
if (ID != null && ID.Length > 0)
hLink.ID = ID;
hLink.Target = Target;
hLink.AccessKey = AccessKey;
hLink.Enabled = Enabled;
hLink.TabIndex = TabIndex;
if (navigateUrl != null && navigateUrl.Length != 0)
hLink.NavigateUrl = ResolveAdUrl (navigateUrl);
hLink.RenderBeginTag (writer);
if (ControlStyleCreated)
adImage.ApplyStyle(ControlStyle);
if(imageUrl!=null && imageUrl.Length > 0)
adImage.ImageUrl = ResolveAdUrl (imageUrl);
adImage.AlternateText = alternateText;
adImage.ToolTip = ToolTip;
adImage.RenderControl (writer);
hLink.RenderEndTag (writer);
}
示例3: 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 at the begining of each element
writer.Write( " " );
// 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( " " );
}
// 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( " " );
}
// 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;
//.........这里部分代码省略.........
示例4: RenderItem
//.........这里部分代码省略.........
if ((navigateUrl.Length > 0) && !flag3)
{
if (base.PageAdapter != null)
{
base.PageAdapter.RenderBeginHyperlink(writer, control.ResolveClientUrl(navigateUrl), true, System.Web.SR.GetString("Adapter_GoLabel"), (str8 != null) ? str8 : ((this._currentAccessKey < 10) ? this._currentAccessKey++.ToString(CultureInfo.InvariantCulture) : null));
writer.Write(HttpUtility.HtmlEncode(item.FormattedText));
base.PageAdapter.RenderEndHyperlink(writer);
}
else
{
HyperLink link = new HyperLink {
NavigateUrl = control.ResolveClientUrl(navigateUrl)
};
string target = item.Target;
if (string.IsNullOrEmpty(target))
{
target = control.Target;
}
if (!string.IsNullOrEmpty(target))
{
link.Target = target;
}
link.AccessKey = str8;
link.Page = base.Page;
if (writer is Html32TextWriter)
{
link.RenderBeginTag(writer);
SpanPanel panel2 = new SpanPanel {
Page = base.Page
};
this.RenderStyle(writer, panel2, str6, menuItemStyle, flag4);
panel2.RenderBeginTag(writer);
item.RenderText(writer);
panel2.RenderEndTag(writer);
link.RenderEndTag(writer);
}
else
{
this.RenderStyle(writer, link, str6, menuItemStyle, flag4);
link.RenderBeginTag(writer);
item.RenderText(writer);
link.RenderEndTag(writer);
}
}
}
else if (base.PageAdapter != null)
{
base.PageAdapter.RenderPostBackEvent(writer, control.UniqueID, (flag3 ? 'o' : 'b') + this.Escape(item.InternalValuePath), System.Web.SR.GetString("Adapter_OKLabel"), item.FormattedText, null, (str8 != null) ? str8 : ((this._currentAccessKey < 10) ? this._currentAccessKey++.ToString(CultureInfo.InvariantCulture) : null));
if (flag3)
{
this.RenderExpand(writer, item, control);
}
}
else
{
HyperLink link2 = new HyperLink {
NavigateUrl = base.Page.ClientScript.GetPostBackClientHyperlink(control, (flag3 ? 'o' : 'b') + this.Escape(item.InternalValuePath), true),
AccessKey = str8,
Page = base.Page
};
if (writer is Html32TextWriter)
{
link2.RenderBeginTag(writer);
SpanPanel panel3 = new SpanPanel {
Page = base.Page
};
示例5: RenderItem
//.........这里部分代码省略.........
if (navigateUrl.Length > 0 && !clickOpensThisNode) {
if (PageAdapter != null) {
PageAdapter.RenderBeginHyperlink(writer,
owner.ResolveClientUrl(navigateUrl),
true,
SR.GetString(SR.Adapter_GoLabel),
itemAccessKey != null ?
itemAccessKey :
(_currentAccessKey < 10 ?
(_currentAccessKey++).ToString(CultureInfo.InvariantCulture) :
null));
writer.Write(HttpUtility.HtmlEncode(item.FormattedText));
PageAdapter.RenderEndHyperlink(writer);
}
else {
HyperLink link = new HyperLink();
link.NavigateUrl = owner.ResolveClientUrl(navigateUrl);
string target = item.Target;
if (String.IsNullOrEmpty(target)) {
target = owner.Target;
}
if (!String.IsNullOrEmpty(target)) {
link.Target = target;
}
link.AccessKey = itemAccessKey;
link.Page = Page;
if (writer is Html32TextWriter) {
link.RenderBeginTag(writer);
SpanPanel lbl = new SpanPanel();
lbl.Page = Page;
RenderStyle(writer, lbl, linkClass, mergedStyle, applyInlineBorder);
lbl.RenderBeginTag(writer);
item.RenderText(writer);
lbl.RenderEndTag(writer);
link.RenderEndTag(writer);
}
else {
RenderStyle(writer, link, linkClass, mergedStyle, applyInlineBorder);
link.RenderBeginTag(writer);
item.RenderText(writer);
link.RenderEndTag(writer);
}
}
}
// Otherwise, write out a postback that will open or select the item
else {
if (PageAdapter != null) {
PageAdapter.RenderPostBackEvent(writer,
owner.UniqueID,
(clickOpensThisNode ? 'o' : 'b') +
Escape(item.InternalValuePath),
SR.GetString(SR.Adapter_OKLabel),
item.FormattedText,
null,
itemAccessKey != null ?
itemAccessKey :
(_currentAccessKey < 10 ?
(_currentAccessKey++).ToString(CultureInfo.InvariantCulture) :
null));
// Expand image
if (clickOpensThisNode) {
RenderExpand(writer, item, owner);
}
}
else {
示例6: RenderLink
private void RenderLink(HtmlTextWriter writer, AdCreatedEventArgs adArgs)
{
HyperLink link = new HyperLink {
NavigateUrl = adArgs.NavigateUrl,
Target = this.Target
};
if (base.HasAttributes)
{
foreach (string str in base.Attributes.Keys)
{
link.Attributes[str] = base.Attributes[str];
}
}
if (!string.IsNullOrEmpty(this.ID))
{
link.ID = this.ClientID;
}
if (!this.Enabled)
{
link.Enabled = false;
}
string str3 = (string) this.ViewState["AccessKey"];
if (!string.IsNullOrEmpty(str3))
{
link.AccessKey = str3;
}
object obj2 = this.ViewState["TabIndex"];
if (obj2 != null)
{
short num = (short) obj2;
if (num != 0)
{
link.TabIndex = num;
}
}
link.RenderBeginTag(writer);
Image image = new Image();
if (base.ControlStyleCreated)
{
image.ApplyStyle(base.ControlStyle);
}
string alternateText = adArgs.AlternateText;
if (!string.IsNullOrEmpty(alternateText))
{
image.AlternateText = alternateText;
}
else
{
IDictionary adProperties = adArgs.AdProperties;
string str5 = (this.AlternateTextField.Length != 0) ? this.AlternateTextField : "AlternateText";
string str6 = (adProperties == null) ? null : ((string) adProperties[str5]);
if ((str6 != null) && (str6.Length == 0))
{
image.GenerateEmptyAlternateText = true;
}
}
image.UrlResolved = true;
string imageUrl = adArgs.ImageUrl;
if (!string.IsNullOrEmpty(imageUrl))
{
image.ImageUrl = imageUrl;
}
if (adArgs.HasWidth)
{
image.ControlStyle.Width = adArgs.Width;
}
if (adArgs.HasHeight)
{
image.ControlStyle.Height = adArgs.Height;
}
string str8 = (string) this.ViewState["ToolTip"];
if (!string.IsNullOrEmpty(str8))
{
image.ToolTip = str8;
}
image.RenderControl(writer);
link.RenderEndTag(writer);
}
示例7: RenderExpandNodeIcon
/// <summary>
///
/// </summary>
/// <param name="writer"></param>
/// <remarks>
/// </remarks>
/// <history>
/// [jbrinkman] 5/6/2004 Created
/// [Jon Henning] 11/28/2005 Added iscrawler logic
/// </history>
protected void RenderExpandNodeIcon( HtmlTextWriter writer )
{
if( _Node.HasNodes )
{
HyperLink _link = new HyperLink();
Image _image = new Image();
if( _Node.IsExpanded || _Node.DNNTree.IsCrawler )
{
_link.Text = _expcol[1];
if( _Node.DNNTree.ExpandedNodeImage.Length > 0 )
{
_image.ImageUrl = _Node.DNNTree.ExpandedNodeImage;
}
}
else
{
_link.Text = _expcol[0];
if( _Node.DNNTree.CollapsedNodeImage.Length > 0 )
{
_image.ImageUrl = _Node.DNNTree.CollapsedNodeImage;
}
}
//If _Node.PopulateOnDemand Then 'handled in postback handler
// _link.NavigateUrl = ClientAPI.GetPostBackClientHyperlink(_Node.DNNTree, _Node.ID & ",OnDemand")
//Else
_link.NavigateUrl = ClientAPI.GetPostBackClientHyperlink( _Node.DNNTree, _Node.ID );
//End If
if( _image.ImageUrl.Length > 0 )
{
_link.RenderBeginTag( writer );
_image.RenderControl( writer );
_link.RenderEndTag( writer );
}
else
{
_link.RenderControl( writer );
}
_image = null;
_link = null;
}
else
{
RenderSpacer( writer, _Node.DNNTree.ExpandCollapseImageWidth );
}
writer.Write( " ", null );
}
示例8: RenderLink
private void RenderLink(HtmlTextWriter writer, AdCreatedEventArgs adArgs) {
Debug.Assert(writer != null);
Debug.Assert(adArgs != null);
HyperLink bannerLink = new HyperLink();
bannerLink.NavigateUrl = adArgs.NavigateUrl;
bannerLink.Target = Target;
if (HasAttributes) {
foreach(string key in Attributes.Keys) {
bannerLink.Attributes[key] = Attributes[key];
}
}
string id = ID;
if (!String.IsNullOrEmpty(id)) {
bannerLink.ID = ClientID;
}
if (!Enabled) {
bannerLink.Enabled = false;
}
// WebControl's properties use a private flag to determine if a
// property is set and does not return the value unless the flag is
// marked. So here we access those properites (inherited from WebControl)
// directly from the ViewState bag because if ViewState bag reference
// was copied to the helper class in the optimized case during the
// Initialize() method, the flags of the properties wouldn't be set
// in the helper class.
string accessKey = (string) ViewState["AccessKey"];
if (!String.IsNullOrEmpty(accessKey)) {
bannerLink.AccessKey = accessKey;
}
object o = ViewState["TabIndex"];
if (o != null) {
short tabIndex = (short) o;
if (tabIndex != (short) 0) {
bannerLink.TabIndex = tabIndex;
}
}
bannerLink.RenderBeginTag(writer);
// create inner Image
Image bannerImage = new Image();
// apply styles to image
if (ControlStyleCreated) {
bannerImage.ApplyStyle(ControlStyle);
}
string alternateText = adArgs.AlternateText;
if (!String.IsNullOrEmpty(alternateText)) {
bannerImage.AlternateText = alternateText;
}
else {
// 25914 Do not render empty 'alt' attribute if <AlternateText> tag is never specified
IDictionary adProps = adArgs.AdProperties;
string altTextKey = (AlternateTextField.Length != 0)
? AlternateTextField : AdCreatedEventArgs.AlternateTextElement;
string altText = (adProps == null) ? null : (string) adProps[altTextKey];
if (altText != null && altText.Length == 0) {
bannerImage.GenerateEmptyAlternateText = true;
}
}
// Perf work: AdRotator should have resolved the NavigateUrl and
// ImageUrl when assigning them and have UrlResolved set properly.
bannerImage.UrlResolved = true;
string imageUrl = adArgs.ImageUrl;
if (!String.IsNullOrEmpty(imageUrl)) {
bannerImage.ImageUrl = imageUrl;
}
if (adArgs.HasWidth) {
bannerImage.ControlStyle.Width = adArgs.Width;
}
if (adArgs.HasHeight) {
bannerImage.ControlStyle.Height = adArgs.Height;
}
string toolTip = (string) ViewState["ToolTip"];
if (!String.IsNullOrEmpty(toolTip)) {
bannerImage.ToolTip = toolTip;
}
bannerImage.RenderControl(writer);
bannerLink.RenderEndTag(writer);
}