brgdotnet
asked on
I need to change the text of my linkbutton using Java Script
I have a very simple Asp.net program. When my hyperlink button is clicked, I need to change the text on the button from "Clicked" to "Now Clicked". I need the text change to occur client side in my Java Script method SomeMethod(obj) .
Can someone help me out here, I cannot figure it out. The code below works, yet I cannot figure out how to change the text.
using System;
using System.Collections.Generic ;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Test1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
LinkButton lb = new LinkButton();
lb.ID = "myLinkeButton";
lb.Text = "UnClicked";
lb.OnClientClick = "return SomeMethod(this)";
form1.Controls.Add(lb);
}
}
-------------------------- --------AS P.Net Code below--------------------- ---------- ---------- ---
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function SomeMethod(obj) {
// In this method,
// How do I change the text of my link button to "Now Clicked";
return false;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
Can someone help me out here, I cannot figure it out. The code below works, yet I cannot figure out how to change the text.
using System;
using System.Collections.Generic
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Test1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
LinkButton lb = new LinkButton();
lb.ID = "myLinkeButton";
lb.Text = "UnClicked";
lb.OnClientClick = "return SomeMethod(this)";
form1.Controls.Add(lb);
}
}
--------------------------
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function SomeMethod(obj) {
// In this method,
// How do I change the text of my link button to "Now Clicked";
return false;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.