BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
Query
How i can set a default value for combo box in add new record row.
|
The reported scenario can be achieved by using the ShowDefaultValuesInAddNewRecord property and setting the default values for each columns using the Fields[“ColumnName”].DefaultValue property. Please make use of the below code,
Code snippet
this.gridGroupingControl1.ShowDefaultValuesInAddNewRecord = true;
this.gridGroupingControl1.TableDescriptor.Fields["CategoryName"].DefaultValue = "Category12345";
this.gridGroupingControl1.TableDescriptor.Fields["Description"].DefaultValue = "Sample2";
this.gridGroupingControl1.TableDescriptor.Fields["CategoryID"].DefaultValue = "Sample1";
this.gridGroupingControl1.TableDescriptor.Fields["SampleData"].DefaultValue = "SampleData12345";
|
Query
How I can do this when I change the first combobox value.It is better if I can implement it within TableControlCurrentCellCloseDropDown event.
|
The reported scenario can be achieved by handling the QueryCellStyleInfo event. Here we have provided the sample in which “CategoryID” column combobox will be set to hide when “Description” column’s value is “Sample2”. Please make use of the below code,
Code snippet
this.gridGroupingControl1.QueryCellStyleInfo += new Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo);
void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity != null && e.TableCellIdentity.Column != null
&& e.TableCellIdentity.Column.Name == "CategoryID"
&& e.TableCellIdentity.DisplayElement.Kind == Syncfusion.Grouping.DisplayElementKind.Record)
{
//Checks if the "Description" column is having value "Sample2"
if (e.TableCellIdentity.DisplayElement.GetRecord().GetValue("Description").ToString() == "Sample2")
{
//Hiding the ComboBox dropdown button
e.Style.ShowButtons = GridShowButtons.Hide;
}
}
}
|