Friday, July 25, 2014

GridConditionalFormatDescriptor and QueryCellStyleInfo- how to format a row and a single cell in gridgroupingcontrol of Syncfusion?

GridConditionalFormatDescriptor only allow you to row formatting. 
Sample:
  GridConditionalFormatDescriptor gridConditionaReplaced = new GridConditionalFormatDescriptor();
            gridConditionaReplaced.Appearance.AnyRecordFieldCell.Font.Bold = true;
            gridConditionaReplaced.Appearance.AnyRecordFieldCell.TextColor = System.Drawing.Color.Brown;
            gridConditionaReplaced.Expression = "[ORDER_STATUS] =  'Replaced'";

            gridList.TableDescriptor.ConditionalFormats.Add(gridConditionaReplaced);

If you want to format any one cell, then you need to use QueryCellStyleInfo or PrepareViewStyleInfo event to achieve that. Below is the example that shows to change backcolor of a negative value cell and bracket for nagative value cell. Please refer to the below code in which QueryCellStyleInfo event is used to achieve your need.
Sample:
this.gridGroupingControl1.QueryCellStyleInfo += new GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo);
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)

if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell
|| e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
{
if (e.TableCellIdentity.Column.MappingName == "B")
{
int cellvalue = Convert.ToInt32(e.Style.CellValue);
if (cellvalue < 0)
{
e.Style.BackColor = Color.Red;
e.Style.Format = "{#,##}"; // You can set your own format
}
}
}
}

Wednesday, July 9, 2014

MS Access Database file deployment in .Net

I found it helpful from stackoverflow that is why I shared with you.

http://stackoverflow.com/questions/18961296/does-access-itself-need-to-be-installed-so-my-net-app-can-use-an-access-databas

Question:
I am developing a .NET program. If I use Access as a database for the purpose of running the program, should Access be installed on the host computer?
If is it not necessary that Access be installed, what should be used for proper running of the program (for example dll file)?
Also, it is important for me to have a low volume program.

Answer:
No, you don't need to have the full Microsoft Access application installed on the machine(s) on which you intend to run your .NET app. What you do need is to have the Microsoft Access Database Engine (a.k.a "ACE") installed on each machine. Note that the installed version of ACE (32-bit or 64-bit) must match the "bitness" of your .NET application (i.e., a 32-bit .NET application will need the 32-bit version of ACE, and a 64-bit .NET application will require the 64-bit version of ACE).
The installers for the Access Database Engine ("ACE") are available here.
http://www.microsoft.com/en-US/download/details.aspx?id=13255