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.
Unfortunately, activation email could not send to your email. Please try again.

Checking specific columns

Thread ID:

Created:

Updated:

Platform:

Replies:

39802 Jan 18,2006 09:19 AM Jan 20,2006 11:42 PM Windows Forms 12
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On January 18, 2006 09:19 AM

Hi there, I''m using a Grid Grouping Control which i have 3 columns. My first and second column does not allow empty value. And for the third column it allow null value. I would like to validate the first and second column to make sure the user must key in some value I''ve tried out for some functions but i couldn''t get what i want. Hope that anyone of you would lend me a helping hand on this. Thanks in advance...

stanleyj [Syncfusion]
Replied On January 18, 2006 11:15 AM

Hi Wyejin, You can either handle the TableControlCurrrentCellValidating / CurrentRecordContextChange events and checking the validation, you can cancel it. (e.Inner.Cancel = true / e.Cancel = true). Regards, Stanley

Administrator [Syncfusion]
Replied On January 18, 2006 09:17 PM

Hi Stanley, Thanks for replying... I was wondering, can i get the validating cell''s value with the 2 events you mention on the previous post? If yes, mind giving me the sample cause there is so much other function insde and i don''t know which one to use.. Thanks in advance :)

stanleyj [Syncfusion]
Replied On January 19, 2006 12:39 AM

Hi Wyejin, See if these code helps. Best regards, Stanley // To make sure that user types in Col1 & Col2 before leaving the record/row private void gridGroupingControl1_CurrentRecordContextChange(object sender, Syncfusion.Grouping.CurrentRecordContextChangeEventArgs e) { if(e.Action == CurrentRecordAction.EndEditCalled) { Record rec = e.Record as Record; if(rec != null) { string col1 = Convert.ToString(rec.GetValue("Col1")); string col2 = Convert.ToString(rec.GetValue("Col2")); if(col1 == "" || col2 == "" ) { e.Cancel = true; } } } } // To make sure that user types in Col1 & Col2 before leaving the currentcell private void gridGroupingControl1_TableControlCurrentCellValidating(object sender, GridTableControlCancelEventArgs e) { GridCurrentCell cc = e.TableControl.CurrentCell; GridTableCellStyleInfo style = e.TableControl.Model[cc.RowIndex, cc.ColIndex]; if(style.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell && ( style.TableCellIdentity.Column.Name == "Col1" || style.TableCellIdentity.Column.Name == "Col2")) { if(cc.Renderer.ControlText == "") e.Inner.Cancel = true; else e.Inner.Cancel = false; } }

Administrator [Syncfusion]
Replied On January 19, 2006 04:32 AM

Thanks again for replying me... The codes that you provide me works perfectly, but unfortunately, there is still some problem.. i''ve attached a few screen shots and my codes to let you have a better picture of what i mean.. Thanks in advance...

Sync.zip

stanleyj [Syncfusion]
Replied On January 19, 2006 09:56 AM

Hi Wyejin, Refer this sample, let me know if you can reproduce that behavior. Best regards, Stanley

Administrator [Syncfusion]
Replied On January 19, 2006 08:44 PM

Hi Stanley, The sample you provide me doesn''t really help much. Is there anyway i can force the gridgroupingcontrol to update and accept the changes i made? Thanks in advance....

Administrator [Syncfusion]
Replied On January 20, 2006 01:45 AM

Hi Wyejin, Attached is a sample in which I have bound a grid grouping control and a grid data bound control to the same data source to show the changes that are being made in a cell and which are getting updated. You may also try to refresh the grid or use RefreshRange methods to see if it might happen due to some refresh problem. Regards, Calvin.

_39802.zip

Administrator [Syncfusion]
Replied On January 20, 2006 07:05 AM

Thanks for replying Calvin.. I''ve tried all the solutions that is provided, but i still can''t manage to solve it.... In this new attached text file, i''ve include all the functions and setting for my gridgrouping control. I hope this helps. :(

Form11.zip

stanleyj [Syncfusion]
Replied On January 20, 2006 07:36 AM

Hi Wyejin, Does cc.EndEdit() helps after cc.Renderer.ControlValue is assigned? Best regards, Stanley

Administrator [Syncfusion]
Replied On January 20, 2006 10:03 PM

Hi... i tried .... this.dgColor.Table.CurrentRecord= null; cc.Renderer.UpdateControlValue(); cc.Renderer.CurrentCell.EndEdit(); this.dgColor.Table.CurrentRecord.EndEdit(); cc.EndEdit(); this.dgColor.EndUpdate(true); but non of them works...

Administrator [Syncfusion]
Replied On January 20, 2006 10:30 PM

Hi i tried removing the TableControlCurrentCellValidating() event for my grid.. and the problem is still there... so i decided to include my grid''s setting here... :( this.dgColor.BackColor = System.Drawing.SystemColors.Window; this.dgColor.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dgColor.Dock = System.Windows.Forms.DockStyle.Fill; this.dgColor.Font = new System.Drawing.Font("Tahoma", 8.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.dgColor.Location = new System.Drawing.Point(0, 0); this.dgColor.Name = "dgColor"; this.dgColor.Size = new System.Drawing.Size(594, 312); this.dgColor.TabIndex = 0; gridColumnDescriptor1.Appearance.AddNewRecordFieldCell.CellValueType = typeof(string); gridColumnDescriptor1.Appearance.AddNewRecordFieldCell.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; gridColumnDescriptor1.Appearance.AddNewRecordFieldCell.Font.Facename = "Tahoma"; gridColumnDescriptor1.Appearance.AddNewRecordFieldCell.Font.Size = 8.5F; gridColumnDescriptor1.Appearance.AddNewRecordFieldCell.MaxLength = 10; gridColumnDescriptor1.Appearance.AddNewRecordFieldCell.ReadOnly = false; gridColumnDescriptor1.Appearance.AnyRecordFieldCell.CellValueType = typeof(string); gridColumnDescriptor1.Appearance.AnyRecordFieldCell.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; gridColumnDescriptor1.Appearance.AnyRecordFieldCell.Font.Facename = "Tahoma"; gridColumnDescriptor1.Appearance.AnyRecordFieldCell.Font.Size = 8.5F; gridColumnDescriptor1.Appearance.AnyRecordFieldCell.MaxLength = 10; gridColumnDescriptor1.Appearance.AnyRecordFieldCell.ReadOnly = true; gridColumnDescriptor1.Appearance.AnyRecordFieldCell.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; gridColumnDescriptor1.HeaderText = "Color Code"; gridColumnDescriptor1.MappingName = "ColorCode"; gridColumnDescriptor1.Name = "colColorCode"; gridColumnDescriptor1.Width = 180; gridColumnDescriptor2.Appearance.AddNewRecordFieldCell.CellType = "TextBox"; gridColumnDescriptor2.Appearance.AddNewRecordFieldCell.CellValueType = typeof(string); gridColumnDescriptor2.Appearance.AddNewRecordFieldCell.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; gridColumnDescriptor2.Appearance.AddNewRecordFieldCell.CultureInfo = new System.Globalization.CultureInfo(""); gridColumnDescriptor2.Appearance.AddNewRecordFieldCell.MaxLength = 50; gridColumnDescriptor2.Appearance.AddNewRecordFieldCell.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; gridColumnDescriptor2.Appearance.AnyRecordFieldCell.CellValueType = typeof(string); gridColumnDescriptor2.Appearance.AnyRecordFieldCell.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; gridColumnDescriptor2.Appearance.AnyRecordFieldCell.MaxLength = 50; gridColumnDescriptor2.Appearance.AnyRecordFieldCell.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; gridColumnDescriptor2.HeaderText = "Description"; gridColumnDescriptor2.MappingName = "Description"; gridColumnDescriptor2.Name = "colDescription"; gridColumnDescriptor2.Width = 391; this.dgColor.TableDescriptor.Columns.AddRange(new Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor[] { gridColumnDescriptor1, gridColumnDescriptor2}); this.dgColor.TabStop = false; this.dgColor.TopLevelGroupOptions.IsExpandedInitialValue = true; this.dgColor.TopLevelGroupOptions.ShowCaption = false; this.dgColor.TopLevelGroupOptions.ShowCaptionPlusMinus = false; this.dgColor.TopLevelGroupOptions.ShowColumnHeaders = true; this.dgColor.VersionInfo = "3.301.0.0";

Administrator [Syncfusion]
Replied On January 20, 2006 11:42 PM

Hi Stanley and Calvin... I realized that it is my CurrentRecordContextChange even''t coding that is causing the problem... The problem has been solve thank you very much for the support that you two provide me... :)

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.

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.

;