web 2.0

ASP.NET(vb.net) & Attribute.Add

ASP.NET(vb.net) & Attribute.Add() - Attribute.Add() : Learn and example how to use Asp.net and Attribute.Add()

ShotDev Focus:
- ASP.NET(vb.net) & Attribute.Add()

Example

Attribute.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Attribute.aspx.vb" Inherits="Attribute" %>
<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<form id="form1" runat="server">
<script language="JavaScript">
function fncTest()
{
alert('Hi Welcome to www.ShotDev.Com');
}
</script>
<asp:Label id="lblText" runat="server" text="Click Here"></asp:Label><br />
<asp:Hyperlink id="hplText" runat="server" text="Click Here"></asp:Hyperlink><br /><br />
<asp:Button id="btnSubmit" runat="server" text="Click Here"></asp:Button><br />
</form>
</body>
</html>

Attribute.aspx.vb


Public Class Attribute
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

'*** Label ***'
With Me.lblText
.Attributes.Add("OnClick", "alert('Sawatdee');")
.Style.Add("cursor", "hand")
End With

'*** Hyperlink ***'
With Me.hplText
.NavigateUrl = "#"
.Attributes.Add("OnClick", "fncTest();")
End With

'*** Button ***'
With Me.btnSubmit
.Attributes.Add("Onclick", "return confirm('Do you want to...?');")
.Style.Add("cursor", "hand")
End With

End Sub

End Class

Screenshot

ASP.NET(vb.net) & Attribute.Add()
.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (No Ratings Yet)
Loading ... Loading ...

One Response to “ASP.NET(vb.net) & Attribute.Add”

  1. 3trackless…

Leave a Reply

You must be logged in to post a comment.