Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Datalist array binding issues

Reply
Thread Tools

Datalist array binding issues

 
 
=?Utf-8?B?c3R1ZGVuNzcx?=
Guest
Posts: n/a
 
      11-03-2006
Thanks in advance to anyone who can help

I have my datalist bound to a normal, single dimension string array (with
three elements) as its data source. In the scripting for the datagrid, I have
it creating a table element in the <HeaderTemplate> and creating a row in the
<ItemTemplate> section. The <FooterTemplate> only has a closing </table> tag
within it.

The problem:
The datagrid is repeating all of the elements in the array as rows in run
time. (i.e., the datalist is repeating the same elements in THREE rows). The
# of times it repeats is dependent on the number of items in the array (i.e.
two elements in the array, and the datalist will repeat the row two times)

Here's the script:
<aspataList ID="dlTest" runat="server"><HeaderTemplate><table><tr
style='color:#FFFFFF; background-color:#0000cc'><th>Name</th><th>Phone
Number</th><th>Title</th></tr></HeaderTemplate>
<ItemTemplate><tr><td><%#this.stuff[0]
%></td><td><%#this.stuff[1]
%></td><td><%#this.stuff[2]%></td></tr></ItemTemplate>
<FooterTemplate></table></FooterTemplate>
</aspataList>

Where [stuff] is the name of the string array.
Anyone?
 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      11-05-2006
You ItemTemplate databinds to the same first 3 array items. According to
this, if the array has 10 items, you will get 10 rows with the same 3 first
items. Is it what you are getting? It is not clear what exactly you are
trying to achieve. Do you want to have three items in each row?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


"studen771" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks in advance to anyone who can help
>
> I have my datalist bound to a normal, single dimension string array (with
> three elements) as its data source. In the scripting for the datagrid, I
> have
> it creating a table element in the <HeaderTemplate> and creating a row in
> the
> <ItemTemplate> section. The <FooterTemplate> only has a closing </table>
> tag
> within it.
>
> The problem:
> The datagrid is repeating all of the elements in the array as rows in run
> time. (i.e., the datalist is repeating the same elements in THREE rows).
> The
> # of times it repeats is dependent on the number of items in the array
> (i.e.
> two elements in the array, and the datalist will repeat the row two times)
>
> Here's the script:
> <aspataList ID="dlTest" runat="server"><HeaderTemplate><table><tr
> style='color:#FFFFFF; background-color:#0000cc'><th>Name</th><th>Phone
> Number</th><th>Title</th></tr></HeaderTemplate>
> <ItemTemplate><tr><td><%#this.stuff[0]
> %></td><td><%#this.stuff[1]
> %></td><td><%#this.stuff[2]%></td></tr></ItemTemplate>
> <FooterTemplate></table></FooterTemplate>
> </aspataList>
>
> Where [stuff] is the name of the string array.
> Anyone?



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView binding - how to stop initial binding Amit ASP .Net 6 10-24-2006 08:06 AM
pywin32 COM sort in Excel (late binding fails, early binding works) (+py2exe) kogrover@gmail.com Python 2 10-20-2006 04:08 PM
Complex data binding question, binding child objects of a custom collection. JcFx ASP .Net Datagrid Control 0 06-01-2005 04:01 PM
Setting up a datalist control - Item_DataBound for a datalist in a datalist Nevyn Twyll ASP .Net 8 09-09-2004 10:13 PM
Data Binding - using inline code vs. functions vs. straight binding Jordan ASP .Net 2 02-10-2004 08:32 PM



Advertisments