Ricky,
The default implementation of webcontrol's Render does this :
1) Calls RenderBeginTag()
2) Calls RenderContents()
3) Then calls RenderEndTag()
Now all the attributes you have added to the attributes collection are
rendered
when RenderBeginTag is called (xml element is created and the attributes in
the collection are added to the element).
What this means in your scenario is that probably the RadioButton's
RenderBeginTag is creating the outside span tag so all the attributes are
added to the span. Now the inner input tag might be getting creaeted in
RenderContents. You could try overriding the RenderContents and before
calling the base.RenderContents add your attributes.
protected override RenderContents(HtmlTextWriter writer) {
writer.AddAttribute("myAtt", "myVal");
base.RenderContents(writer);
}
If even this doesn't work then send me your code and I will try & look for a
fix.
Ajay (mailto:ajayb@grapecity.com)
"Ricky" <forthespammers@nodomaintogiveyou.com> wrote in message
news:#J1qSnztCHA.2540@TK2MSFTNGP10...
> That gives me the same result. Since the radiobutton has two elements to
its
> result, the input tag and label tag, could it be possible that the
> radiobutton class does not know which tag to add the attribute to? If that
> is the case, how does one get at the different tags to manipulate them?
I've
> tried...
>
> base.Controls[0].*
>
> BUT! during the render method, the base object doesn't have any controls
in
> it and it also doesn't have any methods at that point in the hierarchy to
> add an attribute. Is there a way to add my attribute to a specific tag in
> the control?
>
> Thanks,
> Ricky
>
> "Ajay" <ajayb@nospam.grapecity.com> wrote in message
> news:#Evv3DstCHA.1816@TK2MSFTNGP10...
> > protected override void AddAttributesToRender(HtmlTextWriter
writer)
> > {
> >
> > writer.AddAttribute("myAtt", "myVal");
> > base.AddAttributesToRender(writer);
> >
> > }
> >
> > HTH,
> > Ajay
> >
> > "Ricky" <forthespammers@nodomaintogiveyou.com> wrote in message
> > news:OmgScDntCHA.2532@TK2MSFTNGP10...
> > > Hi,
> > >
> > > I am trying to add an attribute to an existing control. So far I have
> > > created a class that inherits the radiobutton control. Added a
property
> to
> > > the control that contains the following code in the set...
> > >
> > > base.Attributes.Add("summary", value);
> > >
> > >
> > > This gives me a span tag (that contains the summary attribute) around
my
> > > input tag. I was hoping to get my attribute into the input tag. Can
> > someone
> > > help me by pointing me in the right direction on how this is done?
> > >
> > > Thank you all in advance for your help!!!
> > >
> > > Ricky
> > >
> > >
> >
> >
>
>