.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

why Datalist control does not render content horizontal if repeatlayout is set to flow ?

Posted By: jagdeep     Posted Date: February 09, 2011    Points:2   Category :ASP.Net
In the below code the content render verically and all in a single column

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Datalist2.aspx.cs" Inherits="Datalist2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<form id="form1" runat="server">
<asp:DataList ID="DataList1" runat="server" RepeatColumns="3"
RepeatDirection="Horizontal" RepeatLayout="Flow" DataKeyField="empId"
<asp:Label ID="empIdLabel" runat="server" Text='<%# Eval("empId") %>' />
<br />
<asp:Label ID="empNameLabel" runat="server" Text='<%# Eval("empName") %>' />
<br />
<asp:Label ID="EmpDesignationLabel" runat="server"
Text='<%# Eval("EmpDesignation") %>' />
<br />
<br />

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:Expt %>"
SelectCommand="SELECT * FROM [tblEmployee]"></asp:SqlDataSource>


Author: Sunil Yadav       [Moderator]      
Posted Date: March 10, 2011     Points: 20   


A flow layout in DataList renders items in inline mode, same as lines of text in a paragraph.
For this reason the above code renders the datalist content vertically and all in a single column.

In order to be able to display it in tabular format, you need to set the RepeatLayout property to Flow .

Hope this helps.

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend