Jump to content

Its not working


nazar ali

Recommended Posts

I have not tried this but does this work?

<asp:ListItem Value="javascript:return variableName"></asp:ListItem>

You would have ot have the variable declared and assigned in the code above this control.

Link to comment
Share on other sites

HiI want to asign javasecript variable value in asp.net code, how iin this line of code where "?" is mentioned<asp:ListItem Value='?' ></asp:ListItem>I am waitingthanks

Hi I think this could help you. I have made an experiment in my page. See how it works. :)
<HTML>	<HEAD>  <title>WebForm1</title>  <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">  <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">  <meta content="JavaScript" name="vs_defaultClientScript">  <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">  <script language="javascript">	function ValueGet(){  var svalue;  document.getElementById("DropDownList1").value ="222";  svalue=	document.getElementById("DropDownList1").value;  document.getElementById("divLabel").value= svalue;	}  </script>	</HEAD>	<body MS_POSITIONING="GridLayout" onload="ValueGet()">  <form id="Form1" method="post" runat="server"> 	 <asp:adrotator id="AdRotator1" runat="server" AdvertisementFile="_xml/ads.xml"></asp:adrotator> 	 <asp:DropDownList id="DropDownList1" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 64px"    runat="server">    <asp:ListItem Value="111" Selected="true">111</asp:ListItem>    <asp:ListItem Value="222">222</asp:ListItem> 	 </asp:DropDownList> 	 <asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 16px; POSITION: absolute; TOP: 104px" runat="server"    Text="Button"></asp:Button> 	 <asp:Label id="lblvalue" style="Z-INDEX: 103; LEFT: 16px; POSITION: absolute; TOP: 144px" runat="server">Label</asp:Label> 	 <INPUT id="divLabel" style="Z-INDEX: 104; LEFT: 16px; POSITION: absolute; TOP: 176px" type="text"></form>	</body></HTML>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...