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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

CellType "ColorEdit"

Thread ID:

Created:

Updated:

Platform:

Replies:

74507 Jun 17,2008 10:53 AM UTC Jun 18,2008 02:05 PM UTC WinForms 1
loading
Tags: GridControl
M. Mahesh
Asked On June 17, 2008 10:53 AM UTC

when I select Color from "ColorEdit Cell Type" it should be applied to leftside of the cell

private void buttonAdv1_Click(object sender, EventArgs e)
{

DataTable newtable = new DataTable();
DataColumn dc = new DataColumn("Target Color");
// Add Columns to table
newtable.Columns.Add(dc);
newtable.Columns.Add("Source Color");
// Add rows
DataRow newrow = newtable.NewRow();
newrow["Target Color"] = " ";
newtable.Rows.Add(newrow);

this.gridDataBoundGrid1.Binder.InitializeColumns();

this.gridDataBoundGrid1.Model.ColWidths.ResizeToFit
(GridRangeInfo.EmptyRange(), GridResizeToFitOptions.NoShrinkSize);
this.gridDataBoundGrid1.DataSource = newtable;
}

private void Model_QueryCellInfo(object obj, GridQueryCellInfoEventArgs e)
{
GridStyleInfo stlinfo = new GridStyleInfo();
stlinfo.CellType = "ColorEdit";

if ( (e.RowIndex==1 || e.RowIndex==2) && e.ColIndex == 2)
{
e.Style.CellType = stlinfo.CellType;


}


Sri Rajan [Syncfusion]
Replied On June 18, 2008 02:05 PM UTC

Hi Mahesh,

Thank you for your interest in Syncfusion products.

Please refer the below code to achieve this behaviour.

void gridDataBoundGrid1_CurrentCellCloseDropDown(object sender, Syncfusion.Windows.Forms.PopupClosedEventArgs e)
{
GridCurrentCell cc=this.gridDataBoundGrid1.CurrentCell;
this.gridDataBoundGrid1.CurrentCell.MoveTo(GridRangeInfo.Cell(cc.RowIndex, cc.ColIndex - 1));
}

void Model_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e)
{
GridStyleInfo stlinfo = new GridStyleInfo();
stlinfo.CellType = "ColorEdit";
if ((e.RowIndex == 1 || e.RowIndex == 2) && e.ColIndex == 2)
{
e.Style.CellType = stlinfo.CellType;
}
if ((e.RowIndex == 1 || e.RowIndex == 2) && e.ColIndex == 1)
{
GridStyleInfo style = this.gridDataBoundGrid1.Model[e.RowIndex, e.ColIndex + 1];
e.Style.BackColor = ColorConvert.ColorFromString(style.CellValue.ToString());
}
}


Please let me know if this helps.

Best Regards,
Srirajan



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;