3

I've created a web control and I want to pass the element attributes through during the render phase. I would prefer use writer.RenderBeginTag() and RenderEndTag() but this is the only way I can seem to integrate the attributes successfully:

public override void RenderBeginTag(HtmlTextWriter writer)
{
    writer.Write("<");
    writer.Write(this.Tag);
    this.Attributes.Render(writer);
    writer.Write(">");
}

Is there another way to do this without looping through the Attributes collection?

BC.
  • 24,298
  • 12
  • 47
  • 62

1 Answers1

4
writer.WriteBeginTag(this.Tag);
this.Attributes.Render(writer);
writer.Write(HtmlTextWriter.TagRightChar);
Rex M
  • 142,167
  • 33
  • 283
  • 313