C# .NET - Merge two columns in a tablelayoutpanel

Asked By Srinivasan S on 04-Dec-11 11:27 PM
I want to merge two columns in a tablelayoutpanel control? I used this code, but i couldnot find anything.
 
tableLayoutPanel1.SetColumnSpan(button1, 2);
 
help me..
Riley K replied to Srinivasan S on 04-Dec-11 11:35 PM

To span columns and rows

  1. Drag a TableLayoutPanel control from the Toolbox onto your form.

  2. Drag a http://msdn.microsoft.com/en-us/library/system.windows.forms.button%28v=VS.80%29.aspx control from the Toolbox into the upper-left cell of the TableLayoutPanel control.

  3. Set the Button control's ColumnSpan property to 2. Note that the Button control spans the first and second columns.

  4. Set the Button control's RowSpan property to 2. Note that the Button control spans the first and second rows.

  5. Set the Button control's ColumnSpan property to 1. Note that the Button control moves into the first column and spans the first and second rows.

Refer this link
http://

Regards
Riley K replied to Srinivasan S on 04-Dec-11 11:45 PM
Asked By Srinivasan S on 04-Dec-11 11:47 PM
I have a panel with backgorundimage looks like a table image. I just placed a tablelayoutpanel over on panel and set its backcolor as "Transparent".

Now I want to merge two columns ina tablelayoutpanel, so that the line between two columns should be hide or invisible.

How can I achieve this?
DL M replied to Srinivasan S on 04-Dec-11 11:57 PM
Cells can be merged in the TableLayoutPanel control by setting the ColumnSpan or RowSpan properties on a child control. To span two columns, either set the ColumnSpan property of the control to 2, or at run time use the SetColumnSpan method.

tlp.SetColumnSpan(button1, 2);

To span two rows, either set the RowSpan property of the control to 2, or at run time use the SetRowSpan method.

tlp.SetRowSpan(button1, 2);
Srinivasan S replied to DL M on 05-Dec-11 12:07 AM
Ok. Have to place a button control in a specific column on tablelayoutpanel? or How can I do this?

Explain me clearly..
Anoop S replied to Srinivasan S on 05-Dec-11 02:04 AM
If you're adding the controls to the TLP in the designer then the controls themselves gain ColSpan and RowSpan properties. You can put the control in the left-hand column and just set the ColSpan to 2.
dipa ahuja replied to Srinivasan S on 05-Dec-11 02:42 AM
Get the select Query this way:

 
void getReuslt()
{
    string ConnString = "ConnectionString";
    SqlDataAdapter da = new SqlDataAdapter("SELECT gender, (fname+ ' ' + lname)  as name from people", ConnString);
    DataTable dt = new DataTable();
    da.Fill(dt);
    GridView1.DataSource = dt;
    GridView1.DataBind();
} and now set the name column on particular position