We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GridGroupingControl problem with column width

Hi
I couldn't set column width in my GridGroupingControl. please provide the solution.

I have used as following code.
GridGroupingControl1.Table.TableDescriptor.Columns(0).Width = 300
GridGroupingControl1.Table.TableDescriptor.Columns(1).Width = 100

But it was not reflected on runtime.

Thank you




7 Replies

RS Rajarajeswari S Syncfusion Team July 4, 2008 09:48 AM UTC

Hi Kalyani,

Thanks for using Syncfusion products.

I am afraid that I am not able to reproduce the issue. Please refer the below code snippet to set column width.

this.GridGroupingControl1.TableDescriptor.Columns[1].Width = 300;

Please refer the below screen shot in which "Column2" has been set as 300:

http://www.syncfusion.com/support/user/uploads/colwidth_8cba4ef9.png

Please refer the sample from the below link which illustartes the above:


http://www.syncfusion.com/support/user/uploads/ColWidth_3258a3ce.zip


Please let me know if you have any other concerns.

Regards,
Raji



RS Rajarajeswari S Syncfusion Team July 4, 2008 09:56 AM UTC

Hi Kalyani,

Thanks for using Syncfusion products.

I am afraid that I am not able to reproduce the issue. Please refer the below code snippet to set column width.

this.GridGroupingControl1.TableDescriptor.Columns[1].Width = 300;

Please refer the below screen shot in which "Column2" has been set as 300:

http://www.syncfusion.com/support/user/uploads/colwidth_8cba4ef9.png

Please refer the sample from the below link which illustartes the above:


http://www.syncfusion.com/support/user/uploads/ColWidth_3258a3ce.zip


Please let me know if you have any other concerns.

Regards,
Raji



SS Saurabh Srivastava December 13, 2008 11:47 AM UTC


Hi,

I am also facing the same issue. Please help



RS Rajarajeswari S Syncfusion Team December 15, 2008 06:24 AM UTC

Hi Saurabh,

I am afraid that I am not able to reproduce the issue, that you have mentioned here. Applying Custom CSS doesn’t affect of setting column width. Please refer the below sample where I have followed the below things:

1. Created Grid, and applied custom CSS.
2. Creating a new column dynamically.
3. Setting width for the dynamically created column.
4. The width is applied to the column properly.

Please refer the below code snippet which illustrates this:

protected void Button1_Click(object sender, EventArgs e)
{
this.GridGroupingControl1.TableDescriptor.Columns.Add("NewColumn");
GridColumnDescriptor gcd = this.GridGroupingControl1.TableDescriptor.GetColumnDescriptor("NewColumn");
gcd.Width = 300;
}

Please refer the sample from the below link, which illustrates the above:

http://www.syncfusion.com/support/user/uploads/Sample_f8581c1.zip

Please let me know if you have any other concerns.

Regards,
Raji




SS Saurabh Srivastava December 24, 2008 01:12 PM UTC

Hi Raji,

I have tried to basically nail down the issue here. What I did was took your sample. Instead of generating the datacolumn and adding it to the datatable what I did was to just create a datatable and execute a stored procedure to fill in the datatable. Now assign that datatable to your grid and the grid column width setiings cannot be overriden. Can you please check this?




SS Saurabh Srivastava December 24, 2008 01:14 PM UTC

Hi,

This is the code:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Data.SqlClient;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
{
private string connectionString = String.Empty;
private DataTable reservationRecords = new DataTable();

protected void Page_Load(object sender, EventArgs e)
{


connectionString = "xxxxx";

if (!IsPostBack)
{

SqlConnection connection = new SqlConnection(connectionString);
SqlCommand command = new SqlCommand();

command.Connection = connection;
command.CommandTimeout = 0;
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "sp_SelectReservation";

SqlDataAdapter adapter = new SqlDataAdapter(command);
adapter.Fill(reservationRecords);
connection.Dispose();

GridGroupingControl1.DataSource = reservationRecords;


GridGroupingControl1.TableOptions.AllowHover = false;
GridGroupingControl1.TableOptions.AllowDragColumns = false;
GridGroupingControl1.TableOptions.ListBoxSelectionMode = Syncfusion.Web.UI.WebControls.Shared.SelectionMode.None;
GridGroupingControl1.TableOptions.AllowDropDownCell = false;
this.GridGroupingControl1.TableOptions.ShowRowHeader = false;

this.GridGroupingControl1.ChildGroupOptions.ShowCaptionPlusMinus = false;


}
this.GridGroupingControl1.TableDescriptor.Columns[5].Width = 300;
}
}




RS Rajarajeswari S Syncfusion Team December 26, 2008 01:36 PM UTC

Hi Saurabh,

Thanks for using Syncfusion products.

Regardless of the Database the Width properly will work properly with GridGroupingControl, But we have found some issue with WebPart applications.

With normal page models it is working fine that has been illustrate for you with the samples of previous updates.

If still you have found issue with normal Page models, could you please reproduce the issue with the above sample and send back to us? so that we could sort out the cause of the issue very soon and provide you a better solution.

Regards,
Raji





Loader.
Live Chat Icon For mobile
Up arrow icon