Button Type

S

Shawn B.

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
 
S

Shawn B.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top