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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to combine two columns in the GridView?

Posted By:      Posted Date: October 06, 2010    Points: 0   Category :ASP.Net

Hi all,

If I have two two columns: Date1 and date2,
I would like to display in GridView1 than one column.

Date1 = 10/06/2010
Date2 = 07.10.2010

GridView1 (date1 + date2) = 06.10.2010 - 07.10.2010



View Complete Post

More Related Resource Links

Adding Multiple Columns and Rows in GridView without using a Database

This article describes on how to add multiple columns and rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in each TextBoxes on Button Click and retain the GridView data on post back.

add columns with textboxes in gridview using C#

'm working on a shopping cart in a website and I have my items(which have been added to the cart) in an arraylist. And using these values I've read the rest of the values from the db and and have populated on the gridview successfully.

Sorting GridView Columns Manually

We all know that GridView columns can be sorted automatically when SQLDataSource is being used. But what if you are not using SqlDataSource to populate the GridView. Sorting the GridView manually is pretty straight forward task take a look at the code below

How to let user edit selected gridview columns, not entire row



I've got a gridview I would like to let the user edit a couple of columns.  Seems like everything I'm coming across so far makes the entire row editable.  

Hopefully the solution isn't too complicated.  Can someone point me in the right direction?


gridview help on each dynamic row solve this show values based on all columns

<asp:GridView style="Z-INDEX: 101; LEFT: 1px; POSITION: absolute; TOP: 183px" id="Gridview1" runat="server" Width="613px" Height="127px" ForeColor="Teal" Font-Size="12pt" Font-Names="Palatino Linotype" Font-Bold="True" Visible="False" BorderColor="Transparent" AutoGenerateColumns="false" CellSpacing="2" GridLines="None" OnRowCreated="Gridview1_RowCreated" SelectedIndex="5" ShowFooter="true" OnRowDataBound="Gridview1_RowDataBound"><Columns>  <asp:TemplateField HeaderText="ItemCode"><ItemTemplate> <asp:DropDownList id="DropDownList1" tabIndex=16 runat="server" AutoPostBack="True" DataValueField=" ItemCode " DataTextField=" ItemCode" ></asp:DropDownList></ItemTemplate></asp:TemplateField>  <asp:TemplateField HeaderText="ItemName"><ItemTemplate> <asp:DropDownList id="DropDownList2" tabIndex=16 runat="server" AutoPostBack="True" DataValueField="ItemName" DataTextField="ItemName" ></asp:DropDownList> </ItemTemplate> </asp:TemplateField>  <asp:TemplateField HeaderText="Category"&

how to Freeze specific columns in GridView

My question is how to freeze specifi columns of Gridview control ?Freeze means...for example say if we are freezing the first column of grid then on scrolling a horizontal scroll bar of the grid will scroll all columns other than the first column. That means the first column will be visible always without any movement. But the first column should move if we use the vertical scroll bar. thanks is advance satish  

AutoFilter GridView columns

Are there any good tutorials out there for making a GridView filterable by column within the GridView? For an example of what I mean, consider the jqGrid plugin. http://www.trirand.net/demoaspnet.aspxI don't understand why the native MS GridView has never been updated to include functionality like this... 

Insert columns into GridView and rendercontrol error

Hi I´m inserting columns into a gridview at run time using: gvRageReport.Columns.Insert(index, column) When I render the gridview in orther to export to excel all the excel columns are empty except the new insert columns, but when I add the new columns using gvRageReport.Columns.Add(column) the excell is exported successfully.Any idea?

have print friendly page, want to hide columns of gridview

using vb.net/asp.net 2005I have linkbuttons calling the javascript function at the bottom of this post to print out the contents of a div and this is working ok but theissue that i have is inside the div is a gridview that displays links and another text column (among other colums) and I would like tohide the links and the text column next to it using css.Has anyone done this?btw, here is the javascript print function# function printThisDiv() # { # try{ # var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,"; # sOption+="scrollbars=yes,width=750,height=600,left=100,top=25"; # # var sWinHTML = document.getElementById('dvTheDivIWantToPrint').innerHTML; # # # var winprint=window.open("","",sOption); # winprint.document.open(); # winprint.document.write('<html><body>'); # winprint.document.write(sWinHTML); # winprint.document.write('</body></html>'); # winprint.document.close(); # winprint.focus(); # # }catch(err){ # txt="There was an error on this page.\n\n"; # txt+="Error description: " + err.description + "\n\n"; # txt+="Click OK to continue.\n\n"; # alert(txt); # } }

How to use CSS to style just one of the columns in a GridView control

<asp:Boundfield Datafield="City" Headertext="City" sortexpression="City" CONTROLSTYLE-CSSCLASS="allcaps"/> I'm trying to use the CSS property "text transform" to make just one specific GridView column "all caps" (see above), but it has no effect. It only works when I place the reference to the class ".allcaps"  in the main tag at the top of the GridView control---but that makes all columns "all caps". How can I style just one column using CSS?   Thanks.  

Creating dynamic template columns in gridview

how to create dynamic template columns in gridview  . I have writing some of the code but it gives me error The type or namespace name 'GridViewLabelTemplatecould' not be found (are you missing a using directive or an assembly reference?)    I have paste some my code /con.Open();        string strsql = "select ID,CompanyName from tblcompany";               SqlCommand cmd = new SqlCommand();        cmd.CommandType = CommandType.Text;        cmd.CommandText = strsql;        cmd.Connection = con;        SqlDataAdapter adpt = new SqlDataAdapter();        adpt.SelectCommand = cmd;        adpt.Fill(dt);        GridView1.Columns.Clear();        for (int i = 0; i < dt.Columns.Count; i++)        {            TemplateField tf = new TemplateField();            // create the data rows       

Retrieve data from select columns without creating Gridview etc??

I have an accessdatasource with multiple columns, one column I use it to populate a dropdownlist. Can I use the data from other columns to insert into a table,  insert being done in the aspx.vb page, without creating gridview etc.   Is it possible to make a detailsview one column visible= false and still be able to evaluate its contents? Thanks,

Gridview bounds fields I want to combine two of them ???



 I have a gridview on my page bound to an object data source which gets data from a table called "Sizes".

In Table Sizes there are "ShoeVersion" and "ShoeSize" Columns. So in the gridview when bound

there are 2 seperate lines.

<asp:BoundField DataField="ShoeVersionId"

How do I use a GridView with a Stored Procedure with changing columns?


I have a stored procedure that returns a dataset with a different number of columns and different column names depending on user input.  How can I use this with a GridView?  Normally I define the columns beforehand in a static fashion, but, have never done a dynamic dataset like this.

GridView Edit Certain Columns


 I have a grid view that contains 5 columns with AutoGenerateEditButton set to True.  All the required events are finished and it behaves like I would expect.

What I want to do next is set the editable row so that only 2 of the 5 columns are editable.  Some of the columns are keys that should be viewable to user, but not editable.

How can I do this?

Set the sorting properties of gridview true but still columns are not becoming links



I have to do a sorting on headers of the gridview.

i have set the sorting property to true and also implemented the onsorting event.

But my headers are not coming up as links,what could be the reason?

GridView split over multiple columns



I have a project where I need the one datagrid displaying all values on the one screen, thus I don't have paging enabled.

Is there a way to get a gridview to 'split' over two columns?

ie instead of having

|<- column 1 ->|<- column 2 ->|<-button->|

item 1


Item 30


|<- column 1 ->|<- column 2 ->|<-button->|<- column 1 ->|<- column 2 ->|<-button->|

Item 1                                                            Item 16


Item 15                                                          Item 30

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

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