I want to pass an array from ASP.NET to HTML or Javascript. I'm aware that you can do it by creating an ASP literal, a hidden control, or directly passing a variable, but this seems ugly to me. I'd like the data to sit in a plain old hidden div, so human can read it in the source file. The way I'd LIKE to do it is like this:
<div id="passedindata"> data1,data2,data3,data4,data5, </div>
And in asp.net, I reference the data sequence with
passedindata.InnerHtml
I've written javascript that properly parses the passedindata, but ASP.NET cannot see the div. If I add 'runat="server"' to the div tag, then ASP.NET can use it fine, but asp.net changes the id name of the div, so javascript can no longer see it!
1. How can I make this work?
2. Is this a really wrong way to pass data? If so why?
Thank you.

New Topic/Question
Reply




MultiQuote




|