Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
.cs page code
public static list<string> abc=new list<string>();


I want to access this list on .aspx page in <script> tag to add some content in list using javascript.
Posted
Updated 13-Feb-13 8:52am
v2
Comments
Sergey Alexandrovich Kryukov 13-Feb-13 14:53pm    
What list in HTML? What are you talking about?
—SA
Dev Ashish Jangid 2-Mar-13 1:57am    
list means collection classes type....just like.
public static List<string> list_name=new List<string>();
Sergey Alexandrovich Kryukov 2-Mar-13 20:06pm    
What you write won't even compile...
—SA

Hi,

When Using Javascript u can create html element By using InnerHTML

Example

<script>
function Bind()
{
var res="<ul>";
for(int i=1;i<=10;i++)
{
res=+ "< li > Item "+ 1 +"</li>"
}
res=+"</ul>";
document.getElementByID("list").InnerHTML = res;
}

</script>
 
Share this answer
 
i am not sure for what you are trying to do , use this in script tag
XML
function GetMyValue(){
    eval("var someVar = " + parseInt<%=this.MyInteger%>"));
    //Do something
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900