Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > max table columns in Repeater control

Reply
Thread Tools

max table columns in Repeater control

 
 
Brian W
Guest
Posts: n/a
 
      05-16-2004
I have an array of strings:

s[0] = "string 0";
s[1] = "string 1";
s[2] = "string 2";
s[3] = "string 3";
s[4] = "string 4";
s[5] = "string 5";
s[6] = "string 6";
s[7] = "string 7";
s[8] = "string 8";
s[9] = "string 9";
s[10] = "string 10";

and I want to display them in a table using a Repeater(?) like this:

"string 0" "string 1" "string 2" "string 3" "string 4"
"string 5" "string 6" "string 7" "string 8" "string 9";
"string 10"

Is something like this possible with a Repeater? How? Example?


TIA
Brian W


 
Reply With Quote
 
 
 
 
Natty Gur
Guest
Posts: n/a
 
      05-17-2004
Hi,

Yes it possible but with DataList:

you need to add lable to your DataList and bind it to container
dataitem. then set your array as DataList datasource and bind array to
DataList:

Page ASPX file :

<aspataList id="DataList2" style="Z-INDEX: 106; LEFT: 219px; POSITION:
absolute; TOP: 270px"
runat="server" Height="82" Width="231" RepeatDirection="Horizontal"
RepeatColumns="4">
<ItemTemplate>
<asp:Label id=Label1 runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem") %>'>
</asp:Label>
</ItemTemplate>
</aspataList>

page code behind :

string[] s = new string[11];
s[0] = "string 0";
s[1] = "string 1";
s[2] = "string 2";
s[3] = "string 3";
s[4] = "string 4";
s[5] = "string 5";
s[6] = "string 6";
s[7] = "string 7";
s[8] = "string 8";
s[9] = "string 9";
s[10] = "string 10";

this.DataList2.DataSource = s;
DataList2.DataBind();

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
 
Jeffrey Tan[MSFT]
Guest
Posts: n/a
 
      05-17-2004
Hi Brian,

Based on my understanding, you want to display a string array every 5 items
per row in a table in Asp.net.

Instead of using Repeater control, I think DataList may be more suitable
for you. Do like this:

private void Page_Load(object sender, System.EventArgs e)
{
string [] arr=new string[11];
for(int i=0;i<11;i++)
{
arr[i]="string"+i;
}
this.DataList1.DataSource=arr;
this.DataList1.DataBind();
}

<aspataList id="DataList1" RepeatColumns="5" RepeatDirection="Horizontal">
<ItemTemplate>
<%# Container.DataItem.ToString()%>
</ItemTemplate>
</aspataList>

=============================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

 
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
want max width and max height as long as not exceed 100px Summercool HTML 9 10-23-2007 02:27 AM
Repeater Control - 3 Columns - Unlimited Rows Peggy ASP .Net 1 05-17-2007 06:52 PM
Align table columns with gridview columns Jacksm ASP .Net 2 11-21-2006 09:49 PM
Max Apperture and Max. Shutter Speed Confusion-HELP bhaskar Digital Photography 12 07-22-2003 05:17 PM



Advertisments