Jump to content

Its not working

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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...