C# - Display GridView With Many Columns As Two Sets Of Columns?

Jan 20, 2010

I apologize for the odd title. I've been trying to figure out how to do this and can't quite put it into words. Basically, I need to try to display a GridView with a whole bunch of columns (37 in one case) in two "rows" of columns. More or less.

So instead of this:

Column1 Column2 Column3 Column4 Column5 Column6
Data Data Data Data Data Data
Data Data Data Data Data Data
Data Data Data Data Data Data

I'd like something like this:

Column1 Column2 Column3
Data Data Data
Data Data Data
Data Data Data

Column4 Column5 Column6
Data Data Data
Data Data Data
Data Data Data

As in the example there can be multiple rows returned which all need to be displayed. I'm trying to stop a very large horizontal scroll bar being required. I've been searching as much as I can but haven't found anything that fits what I'm looking for.

View 1 Replies


Similar Messages:

AJAX :: How To Display 4 Columns And It's Columns Name In AutoCompleteExtender Control

Feb 9, 2010

I am developing an web application. One of this form has a textbox. When the user enter chars i need to fetch the records from db and display as 4 columns in AUTOCOMPLETEEXTENDER CONTROL TOOL KIT and it's column name also. When the user click any one of the row, i need to get the 2nd clicked column name and display it in textbox.

how to display 4 columns and it column name in autocompleteextender control?

View 1 Replies

C# - GridView - Columns.Insert() Cause Data To Vanish On Postback But Columns.Add() Works OK?

Oct 13, 2010

I have a GridView that has several dynamic columns (I do not know how many at design time and it could be 0-12 columns, hence need for dynamic columns). I have the columns in the grid and data bound to them - works great. There are other standard, design-time TemplateField columns with TextBox controls in them. These are bound with values that the user can edit. The grid is posted back via a Submit button. My question is "Why does gv.Columns.Insert() cause all my TextBox data to be null on Postback, but gv.Columns.Add() works like a champ?"

protected void BuildColumns()
{
// The first column to begin to insert the columns in the GridView
int columnIndex = 5;
BoundField aoColumn = new BoundField();
aoColumn.HeaderText = "New Column 1";
gvMyGrid.Columns.Insert(columnIndex, aoColumn); // kills txtQuantity.Text on postback
gvMyGrid.Columns.Add(aoColumn); // works fine
columnIndex++;
foreach (MyEntity my in _myEntityCollection)
{
BoundField myColumn = new BoundField();
myColumn.HeaderText = String.Format("{0:d}", my.StartDate);
gvMyGrid.Columns.Insert(columnIndex, myColumn);
columnIndex++;
}
}

I then go on to assign values to these BoundFields in the _RowDataBound method and all of this works great. However, when I post back and try to reference some TextBox and they are all null. And yes, I have the BuildColumns() call wrapped in if (!IsPostBack) on Page_Load. Of course I would like to use .Insert() so that the columns can go in the proper location and not at the end of the Columns array.

View 1 Replies

Forms Data Controls :: In Page User Able To Select Gridview Columns And It Will Hide Remaining Columns

Mar 18, 2010

in asp.net page user able to select gridview Columns, and it will hide remaining columns and that selection done by check box with column list bellow is Image link , what exactly I am looking for [URL] it look bellow after selection of column done [URL]

View 1 Replies

Parent Columns And Child Columns Don't Have Type-matching Columns

Aug 3, 2010

i am making relation between two datatables and m getting this error

in this ds.Tables(0).Columns("In_ID") datatype is string
ds.Tables(1).Columns("row_id") datatype is integer

how i do the type casting here to make dataset relation

ds.Relations.Add("Rel_1", ds.Tables(0).Columns("In_ID"), ds.Tables(1).Columns("row_id"), True)

View 3 Replies

Hide Columns In GridView With Auto - Generated Columns?

Jan 19, 2010

GridView1.Columns.Count is always zero even SqlDataSource1.DataBind();

But Grid is ok I can do

for (int i = 0; i < GridView1.HeaderRow.Cells.Count;i++)

I rename request headers here but

GridView1.Columns[i].Visible = false;

I can't use it because of GridView1.Columns.Count is 0. So how can I hide them ?

View 5 Replies

Show Several Columns In Datasource As Autogenerate Columns In Gridview?

Jan 27, 2011

I have a datasource, which includes many columns, idealy, I need use a gridview to show:

1) first 3 columns: template fields, these fields depends on values in some columns of datasource. I use template fields, hard coded. works fine.

2) the other columns. This is I do not know how to do it. In the data source, there are about 10-20 columns data, each time, the # of columns of the data varies. idealy, I need show each of them as a seperated column in gridview. The entire data source may have 30 columns, but some of them are used in 1), and I only want show these 10-20 columns in gridview. Some columns in data source, I may not use them at all. is there a way to do this? or have to seperate them as a detail view style UI?

View 1 Replies

How To Display Gridview Datas As Two Columns

Oct 29, 2010

I have a gridview in a webform. When the page is laoded the data from xml is binded to gridview. Say i have twenty product details in xml. Now i have written code to bind those details with gridview its working fine.

i want to display like this, for exmaple if there are twenty records i want to display ten datas on left and ten datas in right, find the sample below,

Records in dataset,

a 1
b 2
c 2
d 3

this is the way i want to display in gridview,

a 1 c 2
b 2 d 3

View 1 Replies

C# - Addition Of Two Columns Display Its Result In Third Column Of Gridview?

Jan 5, 2011

Rate AnodeRate TotalRate
100 100 200

txtrate,txtanoderate n txttatalrate are added in ItemTemplate of gridview.

rate field is in database table while anoderate n totalrate not in database table ,also totalrate is readonly so that user can see only its addition,this addition will b passed to txtrate field n wil get bind that value in database. also i took

<asp:HiddenField ID="hdnTotalRt" runat="server" /> as it is readonly..

sample code:

enter code here
<asp:TemplateField HeaderText="Standard Rate">
<ItemTemplate>
<asp:TextBox ID="txtRate" runat="server" BorderWidth="0.5pt" Text='<%# Bind("rate") %>' BorderColor="green" BackColor="#ffffcc" Width="40px"></asp:TextBox>

[Code]....

It is showing me error as The name "txtRate"does not exist in d current context

View 1 Replies

Forms Data Controls :: Gridview Display Only 255 Columns?

May 8, 2010

I read excel file into gridview

Excel file has about 500 columns

Gdidview displays only 255 columns

What do you think of this problem??

excel 2003 and 2007 are the same

View 6 Replies

Forms Data Controls :: How To Convert Gridview Rows To Columns And Columns To Rows

Mar 4, 2011

I'm binding a gridview from a webservice with 30 columns and 10 rows, I need to print the same in a PORTRAIT, for that i decided to display columns as rows and

rows as columns like below:

EMP1 1 2 3 4
EMP2 1 2 3 4

View 3 Replies

Data Controls :: Display Dates As Columns In GridView Header

Mar 26, 2014

I want to add the header dynamically during runtime in grid view. I am implementing an attendance application where I want to show the report as absent or present for the last few days for a subject. 1 means present and 0 means absent. How to bind these dates as header during runtime these dates i am getting from database.

Name 17-03-2014 18-03-2014 20-03-2014 21-03-2014 22-03-2014

Rohit 0 1 1 1 1
Raj 0 1 1 1 0
Abhijit 0 1 0 1 1
Sonu Nigam 0 1 1 1 1
Arnold 0 0 1 0 0

View 1 Replies

Data Controls :: GridView - Display Multiple Columns Under One Heading?

May 7, 2015

Gridview code :

<div class="table-responsive">
<asp:UpdatePanel ID="ExistingBuilderGrid_UpdatePanel" runat="server">
<ContentTemplate>
<asp:GridView ID="ExistingBuilderGrid" CssClass="table" EnableViewState="False" AutoGenerateColumns="False"

[Code]....

I want to merger both Fields and both Values column HEADER to one Header cell like Business Assigned Resource ...

NOTE:

dont merge the data cells , only merge header cells

View 1 Replies

Data Controls :: Calculate SUM Of Columns In GridView And Display In Label?

Dec 13, 2013

I have to display sum of Basic_Amt, Tax_Amt, Net_Payable in gridview without using database.

my query.

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CssClass="dataTables_wrapper"
CellPadding="4" ForeColor="#333333" GridLines="None">
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<Columns>

[Code].....

View 1 Replies

Forms Data Controls :: Gridview Display Multiple Columns Under One Heading

Jun 28, 2010

I want to display my data from sql in a grid view. Here the problem is how do I display more than one columns under one column. For example, I have A, B, C, D, E, F columns in sql and then when displaying in Grid, I want to display as 3 columns A, B, C and under column "B" I want to Display D, E, F.

View 19 Replies

Data Controls :: Display Long Text Strings In GridView Columns

Apr 7, 2014

In my website, there is a page called "SMS Log"It contains a GridView, in which there are 5 columns:

1) SMS sent time
2) SMS Text
3) Recipients
4) status
5) Button (view detail) since, "SMS Text" is large and "Recipients" are more than 1.

So Gridview looks very conjusted, also it does not look good.Is there any other control I can use other than Gridview to show above 5 columns in a well organized way.

View 1 Replies

Forms Data Controls :: To Display The Gridview Rows/columns In Breadcrumb Style?

Dec 27, 2010

I want to display the gridview content in breadcrumb style.

View 5 Replies

DataSource Controls :: Removing Duplicates From Two Similar Columns Or Any Other Columns In A Database Schema

Apr 21, 2010

I have two columns first name and last name , that have duplicates, how can i remove the duplicates and only leave the distinct members intact?

View 6 Replies

Forms Data Controls :: Create An ASP Grid With Dynamic Columns With An Ability To Freeze Columns And Rows

Sep 20, 2010

I created a gridview that is made up of 4 gridviews and using a stored procedure to populate it. I create columns at runtime because the number of columns changes all the time.To make the grids editable I am adding template fields at runtime as I create the columns, this is to ensure that a user is able to edit the cells and some foot values update. Reason why I have four grids is to freeze rows and columns like in excel using javascript. The problem is that performance is very bad especially in IE, the grids take a long time to load. I am not sure if this is caused by the data load or the creation of text boxes. see some of the code below for my _aspx page:

[Code]....

View 1 Replies

Entity Framework: Substituting Primary Columns For Foreign Key Columns

Jun 30, 2010

I've created a new ASP.NET website. I've generated an Entity Data Model from my database and have dropped a entitydatasource and gridview onto my page and wired up the gridview to pull from the entitydatasource. Now I get columns like this: id extension prefix did_flag len ten_id restriction_class_id sfc_id name_display building_id floor room phone_id department_id

In each case where the item is named something_id this reflects a foreign key relationship in the database - and I did choose to have the EDM expose foreign key relationships. I'd like to make it so the gridview pulls in the values for these foreign keys rather than just showing the ID numbers - so, for example, department_id might have a value of "101" right now but it should pull from the department table "Marketing".

View 1 Replies

SQL Reporting :: Arrange The Report Parameters In Three Columns Instead Of Two Columns?

Feb 21, 2010

I am trying to arrange the report parameters in three columns instead of two columns. I have about 13 report parameters . Is there a setting anywhere to be done.

View 6 Replies

C# - Avoid Double Columns (predefined Columns + Selectcommand)?

Mar 17, 2011

I have a gridview with predefined columns and a selectcommand. Why do I get the columns twice? I want to keep the predefined columns and the selectcommand, but avoid getting the columns double.

<asp:GridView ID="gvMeldingen" runat="server"
AllowSorting="True" DataSourceID="MyDataSource"
onselectedindexchanged="GridView_SelectedIndexChanged"[code].....

View 1 Replies

Table Colspan Span All Columns Regardless Of # Of Columns

Mar 5, 2010

I'm creating a table in an asp.net code behind dynamically, and I want to have a footer row that only has 2 cells. The first should span all the columns in the table-1. Is there some way other then keeping track of the # of columns in the table manually for me to set the colspan to be # of all the columns in the table-1? Preferably a HTML or CSS solution?

View 2 Replies

Averaging Columns In A Table - Ignoring Certain Columns

Feb 21, 2011

I've the following code which successfully makes an average for all the columns from a table. What I need to do though is ignore certain columns in this equation.

Dim totalNumber as Double = 0
Dim count as Integer = 0
For x = 0 To xyz123.Tables(0).Columns.Count - 1
Dim current as Double = 0
If Double.TryParse(xyz123.Tables(0).Rows(0)(x).ToString(), current) AndAlso current <> 0 Then
count += 1
totalNumber += current
End If
Next
Dim averageRating as Double = totalNumber / count

View 2 Replies

Data Controls :: Display Data Of Multiple Columns In Same Column GridView?

Jan 8, 2014

 have a GridView with two columns:   Part Number |  Part Details

When I search for the part number 12345, the gridview will display like this

PartNumber   |   PartDetails

12345           |   image1  (image1 will see as document picture)

If I search Part Number and doesn't get any data results in gridview the information will be:

PartNumber   |   PartDetails

 0                 |   image2  (image2  will see as red cross picture)

How to change the image2 in the same column cell 1 in the GridView when the data results are "0" ?

Here is my code:

<asp:GridView
Width="570px"
runat ="server"
ID="grdView1"

[Code]....

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved