Click here to Skip to main content
14,668,844 members
Rate this:
Please Sign up or sign in to vote.
See more:
DataSet ds = new DataSet();
        DataTable dt1 = new DataTable("Employee");
        dt1.Columns.Add("Empno");
        dt1.Columns.Add("Empname");
        dt1.Rows.Add("1", "Anbu");
        dt1.Rows.Add("2", "Selvan");

        dt1 = DataBindGrid();
        DataTable dt = new DataTable("Attend");
   
       
        
        dt.Columns.Add("Attendence");
        
        RadioButton chk;
        foreach (GridViewRow rowItem in gridview1.Rows)
        {
           
            chk = (RadioButton)(rowItem.Cells[0].FindControl("rb1"));
            if (chk.Checked)
            {
                
                
            }
            else
            {
                dt.Rows.Add("0");
                
            }

            
        }
        dt1.Merge(dt, false, MissingSchemaAction.Add);
        
        ds.Tables.Add(dt1);



I want result as:
1 anbu 1
2 selvan 0

But result is coming out as:
1 anbu
2 selvan
1
0
Posted
Updated 30-Nov-10 23:41pm
v4

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Hi
Have a look Here[^]
it might be helpful.
   
Comments
Dalek Dave 1-Dec-10 5:41am
   
Don't know why it was marked as accepted and give a 1 vote.
Have a 5 to offset.
Rajesh Anuhya 1-Dec-10 7:14am
   
May be this is the answer for the subject line.., But i did't understood why it's accepted as answer, he alread know about the Merge.

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100