01-17-2007, 07:01 PM
I have GridView getting data from DB.
I want to have Merged Rows in GridView (Not in Header and Footer)..
We have some Student Data on Group based, A student may involve in different Groups.. Once they(user) enter studentId, I am displaying student info in a GridView..
First Group Name
Row1 Data11 Data12 Data13 Data14
Row2 Data21 Data22 Data23 Data24
Second Group Name
Row3 Data31 Data32 Data33 Data34
Row4 Data41 Data42 Data43 Data44
01-18-2007, 06:28 AM
I am not exactly sure what you are asking here but you can merge your data at the query level by concatenating the fields
"SELECT LastName + ', ' + FirstName as StudentName FROM ClassList"
(In ORACLE use | instead of +)
Then in the grid you bind the field you wanted merged to the StudentName records
01-18-2007, 07:41 AM
I am talking about ASP.NET GridView.. not about Database.
Read my first post again.
01-18-2007, 08:21 AM
Yeah, I read your post, and that is why I asked you to be more clear. But you are welcome. I will be sure to give you more help in the future.
01-18-2007, 08:24 AM
It sounds like you want a Nested Gridview. Take a look at this similar thread from a few days ago: http://www.xtremevbtalk.com/showthread.php?t=277194
01-18-2007, 09:14 PM
Thanks, I got solution..
But, I have another problem..
I am doing merging in gridview1_databound method..
and I have checkboxes in grid which causes Postback when they checked..
Problem is: When I click checkbox, rows which are merged and disappearing.. i.e they only appear, when form is loading for the first time..
Code in GridView1_DataBound
Dim tb1 As Table = CType(Me.GridView1.Controls(0), Table)
realIndex = 1
Dim gr1 As GridViewRow = New GridViewRow(realIndex, realIndex, DataControlRowType.Separator, DataControlRowState.Normal)
Dim newCell1 As TableCell = New TableCell
newCell1.ColumnSpan = (Me.GridView1.Columns.Count)
newCell1.Text = "Suneel"
I am binding GridView in Page_Load
If Not Page.IsPostBack Then
Please suggest me.
01-19-2007, 07:03 AM
unfortunately, i have no idea what to suggest. i've never had a reason to manipulate the output from a GridView like this.
01-19-2007, 09:35 AM
Please look at this XVB Project (Visual Studio 2005). try to help me out.
It contains two ASPX Pages, GridView.aspx and PGridView.aspx
In GridView.aspx, I am binding GridView in Page_Load... Becuase of that I am unable to maintain the Checkbox state.
In PGridView.aspx, I am binding GridView in Page_Load (If Not Me.IsPostBack Then.. end if Block). In this case I am able to maintain Checkbox state, But GridView structure is changing..
Please try to look at the code, maybe will get some idea to help me out.
I am attaching as a ZIP File.
Note: The code contains other Logic issue, you will get no errors.. I am trying to display a Title before the group number changes..