Reputation: 7823
I wanna show some values of variables (about 6) inside item template of a Datalist. let's say if i have
Dim A As String = "hello world"
I wanna show that inside the Datalist. Dim A needs to be declared on Page Load or in a method somewhere .. coz the source is the database,so i can't just declare as public const on the top of the page.
I tried this in Datalist but i won't work as expected.
<%= a %>
I also tried putting that different places like ItemDataBound or Page init. it won't work if the way i did was wrong.
In the datasource of Datalist is a datatable with other data. So it is like i am having more than one source for Datalist. Is there any way around other than putting that Dim A inside the datatable?
Thanks Lau
Upvotes: 0
Views: 685
Reputation: 46909
Put as a variable in the class (and assign the value in page load if needed)
Public A As string = "hello world"
Then in the DataList template field use:
<%# A %>
Upvotes: 1