Wednesday, October 5, 2011

Wednesay 8.05.11

Partial Class SettingStyleAttributes
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'perform the initialization only the first time the page is requested
'after that, this information is tracked in view state
If (Not Page.IsPostBack) Then
'set the style attributes to configure appearance
TextBox1.Style("font-size") = "20px"
TextBox1.Style("color") = "red"
'use a slightly different but equivalent syntax
'for setting a style attribute
TextBox1.Style.Add("background-color", "lightyellow")
'set the default text.
TextBox1.Text = ""
'set other nonstandard attributes.
TextBox1.Attributes("onfocus") = "alert(TextBox1.value)"
End If

End Sub
End Class

No comments: