Derived GDBG CellRenderer - ControlValue problem
Hello,
I derived my own GridCellRenderer from GridDropDownCellRenderer.
I'd like it to function similar to ComboBox - with support for saving one value and showing another.
The problem is that, when I type value into the grid's cell (for example 'v2', which is correct and should be save as 2) and press Enter I get
message that "'v2' is not a valid value for Int64".
It seems that Renderer tries to save the ControlText property to DataSource, not the ControlValue, which I'd like to be saved.
(When ControlText can be cast to Int64 everything seems to be right)
Is there any way to save the ControlValue property to DataSource.
Thank you for any help.
Best regards,
Marek S
I derived my own GridCellRenderer from GridDropDownCellRenderer.
I'd like it to function similar to ComboBox - with support for saving one value and showing another.
The problem is that, when I type value into the grid's cell (for example 'v2', which is correct and should be save as 2) and press Enter I get
message that "'v2' is not a valid value for Int64".
It seems that Renderer tries to save the ControlText property to DataSource, not the ControlValue, which I'd like to be saved.
(When ControlText can be cast to Int64 everything seems to be right)
Is there any way to save the ControlValue property to DataSource.
Thank you for any help.
Best regards,
Marek S
SIGN IN To post a reply.
5 Replies
MS
Marek Solarski
March 28, 2007 12:25 PM UTC
Unfortunatelly I didn't manage to attach an example - I get some errors in the WebPage when I try to attach anything :(
This is what I get:
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off".
This is what I get:
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a
HA
haneefm
Syncfusion Team
March 28, 2007 07:59 PM UTC
Hi Marek,
You would have to derive the GridDropDownCellRenderer and override the OnSaveChanges method to save the ControlValue directly. Please try the below code snippet and let me know if this helps.
public class MyDropDownCellRenderer : GridDropDownCellRenderer
{
protected override bool OnSaveChanges()
{
this.Grid.Model[RowIndex,ColIndex].CellValue = this.CurrentCell.ControlValue;//save the cell value directly.
this.CurrentCell.IsModified = false;
return true;
}
}
Best Regards,
Haneef
You would have to derive the GridDropDownCellRenderer and override the OnSaveChanges method to save the ControlValue directly. Please try the below code snippet and let me know if this helps.
public class MyDropDownCellRenderer : GridDropDownCellRenderer
{
protected override bool OnSaveChanges()
{
this.Grid.Model[RowIndex,ColIndex].CellValue = this.CurrentCell.ControlValue;//save the cell value directly.
this.CurrentCell.IsModified = false;
return true;
}
}
Best Regards,
Haneef
MS
Marek Solarski
March 29, 2007 11:27 AM UTC
Hi Haneef,
I derived
protected override bool OnSaveChanges()
as you said and it didn't help.
The example I wanted to attach can be downloaded from here:
http://www.infokrak.com.pl/download/wa24.zip
Have a look at it please.
Best Regards,
Marek
I derived
protected override bool OnSaveChanges()
as you said and it didn't help.
The example I wanted to attach can be downloaded from here:
http://www.infokrak.com.pl/download/wa24.zip
Have a look at it please.
Best Regards,
Marek
HA
haneefm
Syncfusion Team
March 29, 2007 09:12 PM UTC
Hi Marek,
Try override the OnValidate method to achieve this. Please try the modified sample and let me know if this helps.
protected override bool OnValidate()
{
return this.OnSaveChanges();
}
Best regards,
Haneef
Try override the OnValidate method to achieve this. Please try the modified sample and let me know if this helps.
protected override bool OnValidate()
{
return this.OnSaveChanges();
}
Best regards,
Haneef
MS
Marek Solarski
March 30, 2007 12:19 PM UTC
Hi Haneef,
It works fine now.
Thank you for your help.
Regards,
Marek S
It works fine now.
Thank you for your help.
Regards,
Marek S
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
-
MS Marek Solarski
- Mar 28, 2007 12:21 PM UTC
- Mar 30, 2007 12:19 PM UTC