Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear,
I have table in which there may be number of rows and
this rows I want to show in gridview or formview or any else whatever sufficient you think.
for this each column there will be three columns more.
Just like:

The Steps are like caption which are coming from sql table(We don't know how many steps are there)

And For each steps there will be 3 columns and user will add the rows manully
just like dynamic rows using datatable.

HTML
  STEP1                            STEP2                      STEP3
column1 column2 column3   column1 column2 column3     column1 column2 column3

Can we create like this.
If yes, please give me an idea how to do this.


Thank you
Posted
Updated 17-Jan-12 20:23pm
v2
Comments
Anuja Pawar Indore 18-Jan-12 2:24am    
Added pre tag
manognya kota 18-Jan-12 2:29am    
Do u mean the step1,step2,step3... and so on.. will be coming from the back end and the data is entered by users manually?
Jagadeesh Bollabathini 18-Jan-12 3:03am    
Yes.
But There willbe a three columns.
i.e this three columns will be a actual grid columns.
can we do this
thank you

1 solution

On Gridview row created event you have to write like this

C#
protected void Gridview1_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Header)
        {
            GridView HeaderGrid = (GridView)sender;
            GridViewRow HeaderGridRow = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert);
            TableCell HeaderCell = new TableCell();
            HeaderCell.Text = "STEP1";
            HeaderCell.ColumnSpan = 3;            
            HeaderGridRow.Cells.Add(HeaderCell);

            HeaderCell = new TableCell();
            HeaderCell.Text = "STEP2";
            HeaderCell.ColumnSpan = 3;            
            HeaderGridRow.Cells.Add(HeaderCell);

            HeaderCell = new TableCell();
            HeaderCell.Text = "STEP3";
            HeaderCell.ColumnSpan = 3;            
            HeaderGridRow.Cells.Add(HeaderCell);
           

            Gridview1.Controls[0].Controls.AddAt(0, HeaderGridRow);

        }
    }
 
Share this answer
 
v2
Comments
willington.d 6-Mar-13 7:05am    
HiThe step1, step2...step n are coming from db or are you giving input anyware?
Tell us How you are getting Step1, step2...step n and col1, col2.. col n

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900