DataList RepeatColumns

G

Gav

Hi All,

I have created a datalist using the repeatcolumns property to create
multiple columns. I have tried to keep everythings width to 100% so that if
the window is resized it still looks alright. However with these repeating
columns it throws everything out of align because it lets you scroll
horizontally but everything else on the page stops where the original right
side was.

Is there a way it can be set up so that you say repeat the columns n times
maximum but if it can not fit (going over 100%) then wrap onto the next row?

Regards
Gav
 
T

Tian Min Huang

Hello Gav,

Thanks for your post. Currently I am finding somebody to look into this
issue.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
S

Scot Rose [MSFT]

Hi Gav, Do you have a small sample project that reproduces the problem that you can send to me to look at? Either attach it to a reply
here or send it to me at the address below (Remove the online. from teh address)

Also what version of .Net are you using?


Scot Rose, MCSD
Microsoft Visual Basic Developer Support
Email : (e-mail address removed) <Remove word online. from address>

This posting is provided “AS IS”, with no warranties, and confers no rights.

Get Secure!
http://www.microsoft.com/security
http://www.microsoft.com/protect


--------------------
 
J

Jeffrey Tan[MSFT]

Hi Gav,

Thank you for posting in the community! My name is Jeffrey, and I will be
assisting you on this issue.

Based on my understanding, you use DataList control to display a serial of
linkbuttons, and you set its width property to 100% to make its fulfill the
browser window.
But, when you resize your browser window, the pictures always show in one
horizontal line, not wrap, so a horizontal scroll bar will display out.

======================================================
Actually, DataList control will render as <table> <tr> <td>, so in your
source code, you will see that all the imagebutton will be inclued in <td>
tags and in one <tr> tag.(You can determine this through view the page's
html source code)
So the images will not wrap.

I think the simplest way to get what you want(Wrap the images when browser
window resize) is using Repeater server control, which is similar as the
DataList control.
The repeater control give you more customize control of the rendering. It
will not render the <table> tag for you. So it will wrap the images follows
the browser window's size change.

You can try the following Solution to see if it helps resolve your issue:

<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
<asp:ImageButton ImageUrl="lgout.jpg" id="ImageButton1" runat="server"
Width="136px" borderwidth="6"
bordercolor="#ffffcc"></asp:ImageButton>
</ItemTemplate>
</asp:Repeater>

protected System.Web.UI.WebControls.Repeater Repeater1;

private void Page_Load(object sender, System.EventArgs e)
{
DataTable dt= new DataTable();
DataRow dr;

dt.Columns.Add("test");

dr = dt.NewRow();
dr[0] = "1";
dt.Rows.Add(dr);

dr = dt.NewRow();
dr[0] = "2";
dt.Rows.Add(dr);

dr = dt.NewRow();
dr[0] = "3";
dt.Rows.Add(dr);

dr = dt.NewRow();
dr[0] = "4";
dt.Rows.Add(dr);

dr = dt.NewRow();
dr[0] = "5";
dt.Rows.Add(dr);

dr = dt.NewRow();
dr[0] = "6";
dt.Rows.Add(dr);

Repeater1.DataSource = new DataView(dt);
Repeater1.DataBind();
}

The code is almost the same as those in you project, but use the repeater
control instead of Datalist control.

=======================================================
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.
Have a nice day!!

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

Jeffrey Tan[MSFT]

Hi Gav

Have you tried my suggestion of using repeater control?
If it does not meet your need, please feel free to tell me, I will work
with you.

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

Gav

I have managed to try it now and it works great (after a little bit of
tweaking). Thankyou for your help.

Regards
Gavin
 
J

Jeffrey Tan[MSFT]

Hi Gav,

I am glad it works, :)

If you have any further concern, please feel free to tell me.

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.
 

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

Top