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.
Syncfusion Feedback

appending a string to a numeric value in gridboundgrid

Thread ID:

Created:

Updated:

Platform:

Replies:

39332 Jan 4,2006 05:51 PM UTC Jan 6,2006 03:12 PM UTC Windows Forms 3
loading
Tags: GridControl
Trevor Moody
Asked On January 4, 2006 05:51 PM UTC

How do we do this with gridboundgrid. http://support.microsoft.com/default.aspx?scid=kb;en-us;318581 Basically, i want to intercept the value coming from the datasource, do some processing, then display a new value. Thanks Trevor

Administrator [Syncfusion]
Replied On January 5, 2006 04:08 PM UTC

Hi Trevor, you can use DrawDisplayText Event for appending a string with a numeric value. Here is the code snippet. private void gridDataBoundGrid1_DrawCellDisplayText(object sender, Syncfusion.Windows.Forms.Grid.GridDrawCellDisplayTextEventArgs e) { if(e.Style.CellIdentity.ColIndex == 1 && e.Style.CellIdentity.RowIndex > 0) e.DisplayText = "$" + e.DisplayText; } Refer to sample for more details. Let me know, if you need futher assistance. Regards, Madhan.

GridTextBoxColumnDemo.zip

Trevor Moody
Replied On January 5, 2006 06:03 PM UTC

What i actually want to do is take the data coming from the column in the data source, use this data as a key for a lookup in a hashtable, then display the corresponding value from the Hashtable. Is this event a suitable place to do this? Thanks Trevor

Administrator [Syncfusion]
Replied On January 6, 2006 03:12 PM UTC

Hi Trevor, To format the Cell Text ,you need to handle either QueryCellFormattedText Eventhandler/ DrawCellDisplayText Event Handler. Refer to modified sample for more details For DrawCellDisplayText Event Handle: private void gridDataBoundGrid1_DrawCellDisplayText(object sender, Syncfusion.Windows.Forms.Grid.GridDrawCellDisplayTextEventArgs e) { GridModel model = this.gridDataBoundGrid1.Model; if(e.Style.CellIdentity.RowIndex > 0 && e.Style.CellIdentity.ColIndex == 1) { int keyColIndex = model.NameToColIndex("ParentID"); string key = model[e.Style.CellIdentity.RowIndex, keyColIndex].Text; e.Style.Description = key; if (key != null) { object value = celltable[key]; if (value != null) e.DisplayText = value.ToString()+ e.DisplayText; } } } For QueryCellFormattedText Event Handler: Refer this KB article - http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=333 Let me know if you need futher assistance, Regards, Madhan.

GridTextBoxColumnDemo0.zip

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

;