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

Translating values in Datagrid

Thread ID:

Created:

Updated:

Platform:

Replies:

419 Jun 25,2002 10:59 AM UTC Jun 25,2002 05:41 PM UTC WinForms 3
loading
Tags: FAQ
Vipul Bhatt
Asked On June 25, 2002 10:59 AM UTC

My database stores 'F', 'S', 'P' values in a particular DB(Database) field. I want to display them as follows; DB Value Display As ======================================= 'F' ----> Finished Product 'S' ----> Semi Finished Product 'P' ----> Part Can any one please tell me how to achieve this.

Clay Burch [Syncfusion]
Replied On June 25, 2002 11:44 AM UTC

One way you could try to do this is to derive a custom columnstyle. In your derived class, override GetColumnValueAtRow and Commit. In the get override, call the baseclass, and then depending upon whether the value is F, etc, change it to your long name. In your commit override, change the long name to your short name before calling the baseclass. Take a look at this Microsoft KB article, HOW TO: Extend the Windows Form DataGridTextBoxColumn Control to Custom-Format Data (Q318581). It subclasses a DataGridColumnStyle and overrides both GetColumnValueAtRow and Commit to implement this behavior.

Vipul Bhatt
Replied On June 25, 2002 12:59 PM UTC

> One way you could try to do this is to derive a custom columnstyle. In your derived class, override GetColumnValueAtRow and Commit. In the get override, call the baseclass, and then depending upon whether the value is F, etc, change it to your long name. In your commit override, change the long name to your short name before calling the baseclass. > > Take a look at this Microsoft KB article, HOW TO: Extend the Windows Form DataGridTextBoxColumn Control to Custom-Format Data (Q318581). It subclasses a DataGridColumnStyle and overrides both GetColumnValueAtRow and Commit to implement this behavior. Hi Clay.Thanx for your reply. I am new to .net and class fundas.Can you please elaborate or if you can tell me where can i find more info on how to do this. THANX A LOT.

Clay Burch [Syncfusion]
Replied On June 25, 2002 05:41 PM UTC

The Mircosoft article is a step by step tutorial showing how to add CR to negative numbers in a datagrid. You should do that sample, but instead of adding CR in the GetColumnValueAtRow override, change the value from 'F' to 'Fxxxxx' etc. In the Commit override, instead of stripiing the CR off, you would change 'Fxxxx' to 'F'. So, the Microsoft KB should allow you to get a customcolumnstyle. To see how to use it, you can take a look at this sample which uses a custom columnstyle to restrict input to digits. George Shepherd's Windows Forms FAQ contains an entry entitled: How can I restrict the keystrokes that will be accepted in a column of my datagrid? Check it out at: http://www.syncfusion.com/faq/winforms/search/755.asp

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

;