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.
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.