Given below is a simple code for adding on Click Event on a Label control.
First add a Label on aspx page like this.
<asp:label ID="Label1" runat="server" text="CLICKHERE"></asp:label>
Now at the Page Load Event on cs page give this code.
protected void Page_Load(object sender, EventArgs e)
{
Label1.Attributes.Add("onClick", "clickhere();");
}
Now you can define clickhere() function under script in aspx page like this.
<script type="text/javascript">
function clickhere()
{
alert("You Clicked on the LABEL");
}
</script>
0 comments:
Post a Comment