nazar ali Posted April 24, 2006 Share Posted April 24, 2006 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 Link to comment Share on other sites More sharing options...
aspnetguy Posted April 24, 2006 Share Posted April 24, 2006 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 More sharing options...
nazar ali Posted April 24, 2006 Author Share Posted April 24, 2006 Hithanks for reply, butits not working, do some thing<asp:ListItem Value="java script:return variableName"></asp:ListItem><asp:ListItem Value='?' ></asp:ListItem>I am waitingthanks Link to comment Share on other sites More sharing options...
pulpfiction Posted April 24, 2006 Share Posted April 24, 2006 Hi, I dont think so this will work, when you write Value="java script:return variableName"then it will display the whole text "java script:return variableName" in the list. Link to comment Share on other sites More sharing options...
nazar ali Posted April 24, 2006 Author Share Posted April 24, 2006 So what Can i Do to solve this problem? Hi, I dont think so this will work, when you write Value="java script:return variableName"then it will display the whole text "java script:return variableName" in the list.<{POST_SNAPBACK}> Link to comment Share on other sites More sharing options...
aspnetguy Posted April 25, 2006 Share Posted April 25, 2006 please stop asking the same questions in new posts. Stick to this one. Link to comment Share on other sites More sharing options...
Bluecrest Posted April 27, 2006 Share Posted April 27, 2006 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<{POST_SNAPBACK}> 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now