Zymic Forums

Webmaster resources

Zymic IRC Server

Chat in real time at irc.zymic.com - Learn More

Welcome

Welcome to the Zymic webmaster forums. Our forums are here to provide people the free ability to discuss a range of websites related topics such as design, development coding and marketing.

In order to post you will need to register for a zymic account or if you already have one simply login by using the form on the left.

left Zymic Webmaster ForumsWeb Design & DevelopmentServer Side ScriptingOther Languages right
  Closed Topic Start new topic
left right
sbglobal
post Sep 22 2010, 11:22 AM
Post #1


Newbie
*

Group: Members
Posts: 12
Joined: 14-September 10
Member No.: 156,880



Dear user ,
I am using grid-view in asp.net with c# .I want to show all my records in horizontal. I am using this coding
how to show data in column in horizontal view because gird-view data show always in vertical view tell me this coding in

asp.net with C#

This post has been edited by sbglobal: Sep 22 2010, 11:24 AM
Go to the top of the page 
 
  + Quote Post
localinternettra...
post Oct 5 2010, 11:20 AM
Post #2


Newbie
*

Group: Members
Posts: 6
Joined: 19-July 10
Member No.: 149,669



You can make use of the DataList Control instead of the GridView Control. Make sure u specify the RepeatDirection as horizontal.

<asp:DataList ID="DataList1" runat="server" RepeatDirection="Horizontal">

<ItemTemplate>

<asp:Label ID="label1" runat="server" Text='<%# Eval("colomn_name")+ " " %>'></asp:Label>

</ItemTemplate>

</asp:DataList>

and the cs code would be as follows:

SqlConnection connection = new SqlConnection("Integrated Security=true; Initial Catalog=server_name; Data Source=database_name");

protected void Page_Load(object sender, EventArgs e)

{
if (!IsPostBack)

{

SqlCommand command = new SqlCommand("select colomn_name from table_name order by your_id", connection);
SqlDataAdapter adapter = new SqlDataAdapter(command);
DataTable dtEmployees = new DataTable();

adapter.Fill(dtEmployees);

DataList1.DataSource = dtEmployees;

DataList1.DataBind();

}

}

It may help you
Go to the top of the page 
 
  + Quote Post
 Closed Topic Start new topic
left right
0 Members:
left right
 


Lo-Fi Version Time is now: 24th May 2013 - 12:47 PM