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

How to access a cell in GGC

Thread ID:

Created:

Updated:

Platform:

Replies:

54850 Jan 18,2007 06:13 PM UTC Jan 22,2007 09:20 AM UTC WinForms 3
loading
Tags: Grouping
Alexander Polyakov
Asked On January 18, 2007 06:13 PM UTC

Hello.

How can I access a grid cell (in GGC) that corresponds to a particular field (specified by name) of the particular Record?

Cell is needed to set text to. This should make all handlers (such as ApplyFormattedText) execute.

Basically the behavior should be similar to typing text right into the cell except for the cell should not be activated (focused).
I suppose the only way to do this is to refer the cell by CellStyleInfo object. How can I get this object for the field of a record?

The grid control may have several top level tables. It also should support grouping by any number of fields as well as related nested tables.

Regards,
Alexander.

Administrator [Syncfusion]
Replied On January 19, 2007 09:05 AM UTC

Hi Alexander,

We appreciate your kindly patience.

You can get the cell value of particular field in a record by using GetValue method. The following is the code snippet.
>>>>>>>>>>> Code Snippet <<<<<<<<<<
object obj = r.GetValue(“Column1”);
>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<

You can set the value to the cell of a record, by using SetValue method. The following is the code snippet.
>>>>>>>>>>> Code Snippet <<<<<<<<<<
object obj = r.SetValue("Column1",10);
>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<

Also please refer to our evaluation center articles for more details
http://www.syncfusion.com/support/evalcenter/default.aspx?cNode=5

Kindly let us know if you need any further assistance.
Have a nice day.

Best regards,
Madhan

Alexander Polyakov
Replied On January 19, 2007 02:03 PM UTC

Cells we need to change have custom CellModel. This CellModel defines custom formatting rules. E.g. column data type is Int32, but the cell displays "One" for value of 1, "Two" for 2 etc. User can type "One" in the cell and the value will be properly converted to 1 and then set to the Record.
r.SetValue("Column1", 1).
The value "One" cannot be set to record's column of type Int32.

How can I determine ColIndex and RowIndex for the record and the column to use the following code snippet:
tableControl.Model[RowIndex, ColIndex].Text = 'One';

If there any other way to set the text so CellModel.ApplyFormatedText has been executed.

Administrator [Syncfusion]
Replied On January 22, 2007 09:20 AM UTC

Hi Alexander,

Thanks for your response.

You can achieve the intended behavior by two ways. First way is to maintain a separate hash table with key as the user input value and resultant of the hash table to be the integer value. For example, “One” can be made as key and integer ‘1’ can be made has the value. The TableControlCurrentCellValidating can be handled and user input can be validated and respective value can be set accordingly.

>>>>>>>>>>>>> Code Snippet 1 <<<<<<<<<<<<<<<<<<
// Form_Load event
Hashtable hash1 = new Hashtable();
hash.Add("One", 1);
hash.Add("Two", 2);
hash.Add("Three", 3);
hash.Add("Four", 4);
hash.Add("Five", 5);

//TableControlCurrentCellValidating
GridCurrentCell cc = e.TableControl.CurrentCell;
GridTableCellStyleInfo style = e.TableControl.Table.TableModel[cc.RowIndex, cc.ColIndex];
if (style.TableCellIdentity.Column.Name == "FirstName")
{
string text = cc.Renderer.ControlText;
if (hash.Contains(text))
{
int value = Convert.ToInt32(hash[text]);
cc.Renderer.ControlValue = value;
}
}
>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<

Second way, is by using the AutoComplete feature of the comboBox. The display member can be made as a string and value member can be made as integer.

Please let us know if you need any demo sample or assistance.
Have a nice day.

Best regards,
Madhan

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

;