I did this. Here's the results.
If I don't say base.AddAttributesToRender(writer) then the HTML stream for
that control isn't completely render (the style attribute is missing). By
the time I put the style back in the control I may as well just have
recreated the control from scratch. I may be doing something wrong?
If I do, then I get the same thing,
<intput type="button" type="submit"...
---------------
#Region "Overloads"
Protected Overrides Sub AddAttributesToRender( _
ByVal output As HtmlTextWriter _
)
If (ButtonType = ButtonTypes.Default OrElse ButtonType =
ButtonTypes.Submit) Then
output.AddAttribute("type", "submit")
Else
output.AddAttribute("type", LCase(ButtonType.ToString))
End If
MyBase.AddAttributesToRender(output)
End Sub
#End Region
Thanks,
Shawn
[quoted text, click to view] "Teemu Keiski" <joteke@aspalliance.com> wrote in message
news:Ot7ZFh2VDHA.2360@TK2MSFTNGP10.phx.gbl...
> Override the AddAttributesToRender method of your Button.
>
> --
> Teemu Keiski
> MCP, Designer/Developer
> Mansoft tietotekniikka Oy
>
http://www.mansoft.fi >
> AspInsiders Member,
www.aspinsiders.com > ASP.NET Forums Moderator,
www.asp.net > AspAlliance Columnist,
www.aspalliance.com >
> "Shawn B." <leabre@html.com> wrote in message
> news:OipNhziVDHA.1480@tk2msftngp13.phx.gbl...
> > Greets,
> >
> > The Button control is by default rendered as "Submit" type. I would
like
> to
> > change it to "Button" or "Cancel" if I choose.
> >
> > In the render event, I'm saying
> >
> > Attributes.Item("type") = "button"
> >
> > and it's rendering two "type" attributes, one for "Submit" and one for
> > "button"
> >
> >
> > How can I override the attribute and make sure it changes?
> >
> >
> > Thanks,
> > Shawn
> >
> >
>
>