how to assign java script value to label [Resolved]

Posted by Gow.Net under ASP.NET on 9/24/2012 | Points: 10 | Views : 2712 | Status : [Member] | Replies : 3
hi how to assign java script value to label;

<script type="text/javascript">

var url=window.location.href;
alert(url)
</script>


above cod i get url="http://localhost:49162/Autocomplete/Default.aspx"

<asp:Label ID="lbl_key"  runat="server" ></asp:Label>


here i need how to assign that url value to lbl_key

i need below output:
lbl_key="http://localhost:49162/Autocomplete/Default.aspx"

gowthaman8870226416


Responses

Posted by: Jayakumars on: 9/24/2012 [Member] [MVP] Bronze | Points: 50

Up
0
Down

Resolved
hi

try this Code

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type ="text/javascript">
function LblAssin() {
document.getElementById("lbl1").innerHTML = "Jesus Never Fails";
return false;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="lbl1" runat ="server" ></asp:Label>
<asp:Button ID="bt1" runat="server" OnClientClick="return LblAssin();" Text="Submit" />
</div>
</form>
</body>
</html>


Mark as Answer if its helpful to you

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 9/24/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi
Please mark as answer if it helpful to you.

Mark as Answer if its helpful to you

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gow.Net on: 9/24/2012 [Member] Starter | Points: 25

Up
0
Down
hi i try get it one solution
<script type="text/javascript">


var url=window.location.href
function ChangeLabelValue()
{
document.getElementById("lbl_key").innerHTML = url;
}
<script>


and another method

string url = Request.Url.PathAndQuery;

Label1.Text = url;


gowthaman8870226416

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response