views:

44

answers:

1

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?

+1  A: 
writer.WriteBeginTag(this.Tag);
this.Attributes.Render(writer);
writer.Write(HtmlTextWriter.TagRightChar);
Rex M
I knew I could count on you, stackoverflow.
BC