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

B

bienwell

Hi all,

Can we bind the data for a datalist control by an array of column names ?
In my table, I have around 12 field names that contain the value of each
month, year. I have a web page that let users select the number of fields to
perform the query. I already contructed the SQL string and databinding for
the datalist control. The field names selected I stored in the array. In
the datalist control, I cannot specify the column name but use the for loop
to read the field name from the array. The error I've received is the index
of the array is not declared. The syntax like this :

<itemtemplate>
<table width="100%" class="body" border="1" cellpadding="3">
<tr>
<td>
<asp:linkbutton id= "button2" runat= "server" Text= '<%#
DataBinder.Eval(Container.DataItem, "Year") %>' CommandArgument='<%#
DataBinder.Eval(Container.DataItem, "Year") %>' CommandName="select" />
</td>
<% Dim j as integer
For j=0 to UBound(ViewState("ArrField")) %>
<td>
<%# DataBinder.Eval(Container.DataItem,
ViewState("ArrField")(j)) %>
</td>

<% Next %>

</tr>

</table>

</itemtemplate>

I put the link button for the year to perform Annual drilldown data for the
Months of that year.

Do you have any suggestions ? 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,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top