nazar ali 0 Posted April 24, 2006 Report 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 Quote Link to post Share on other sites
aspnetguy 30 Posted April 24, 2006 Report 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. Quote Link to post Share on other sites
nazar ali 0 Posted April 24, 2006 Author Report 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 Quote Link to post Share on other sites
pulpfiction 0 Posted April 24, 2006 Report 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. Quote Link to post Share on other sites
nazar ali 0 Posted April 24, 2006 Author Report 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}> Quote Link to post Share on other sites
aspnetguy 30 Posted April 25, 2006 Report Share Posted April 25, 2006 please stop asking the same questions in new posts. Stick to this one. Quote Link to post Share on other sites
Bluecrest 0 Posted April 27, 2006 Report 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> Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.