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


Top 5 Contributors of the Month
david stephan

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

Populating values of multiple rows in single row using GridView Control

Posted By: nice     Posted Date: March 27, 2011    Points:5   Category :ASP.Net

Hi,

I am trying to populate the values of multiple rows in single row in gridview using c sharp in rowdatabound section of code behind page



Like

Col1 Col6

a 1

a 2

a 3

a 4



I have changed this to

changes to



Col1 Col6

a 1

2

3

4



Now I want to achieve this, any help please?



Col1 Col6

a 1 2 3 4



What wrong with the code below?

if (e.Row.Cells[0].Text == "" && e.Row.Cells[5].Text != "")
{
for (int a = 0; a<GridView1.Rows.Count; a++)
{
string s = GridView1.Rows[a].Cells[5].Text;
GridView1.Rows[e.Row.RowIndex - 1].Cells[5].Text += s;
}
}



What mistake I am making, anyone?

Cell[0] is Col1

Cell[5] is Col6



Thanks in advance

Responses
Author: Maverick             
Posted Date: March 29, 2011     Points: 20   

Hello,

Please copy paste the whole code with a little bit of more clarity.

Thanks,
Maverick

Thanks,
Maverick


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
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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