Problem with databinding for datalist control - Please help !!!

B

bienwell

Hi all,

I have a problem with databinding for the datalist control. In my web
application, I have a web page that help users select some field names in
the table. In my table, there are around 12 fields that stored the number of
each month, year. I need to show the total number in each year, month for
the fields selected from users. I already constructed the SQL string for the
query and bind data for the datalist control. The field names I stored in
the array. I cannot specify the field name for databinding but use the for
loop for that purpose. I got an error "the index j is not declared". Here is
a piece of code in my datalist control.

<itemtemplate>
<table width="100%" class="body" border="1" cellpadding="3">
<tr>
<% Dim j as integer
For j=0 to UBound(ViewState("ArrField")) %>
<td>
<%# DataBinder.Eval(Container.DataItem,
ViewState("ArrField")(j)) %>
</td>
<% Next %>
</tr>
</table>
</itemtemplate>

Please give me your ideas. Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top