adding text to  the value of a gridview cell winforms

Posted on 2014-07-21
Medium Priority
Last Modified: 2014-08-18
I have a gridview -  I am trying to add text to a cells value when the gridview is loading by using the formatting event. Bu unfortunately the app does not like what I have done at all :D Does anyone know how to append text to the end of the value in a gridview cell
 private void gvDataWords_CellFormatting(object sender, CellFormattingEventArgs e)
            Char degree = (Char)176;
            if (e.CellElement.RowInfo.Cells["thevalue"].Value != null)
                string title = e.CellElement.RowInfo.Cells["thelabel"].Value.ToString();
                //if(title == "Temperature" && tempMultiplier == "1")
                int myVal = Int32.Parse(e.CellElement.RowInfo.Cells["thevalue"].Value.ToString());
                e.CellElement.RowInfo.Cells["thevalue"].Value = Convert.ToString(myVal) + degree + " C";
                //if ((string)e.CellElement.RowInfo.Cells["thelabel"].Value == "Temperature" && tempMultiplier == "1")
                   // e.CellElement.RowInfo.Cells["thevalue"].Value = Convert.ToString(thevalue.Value + "°");


Open in new window

Question by:r3nder
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 52

Expert Comment

by:Carl Tawn
ID: 40210981
What versions of .Net are you using and what version of Visual Studio? What control are you using, is it a DataGridView, or have you got a third-party GridView from somewhere?
LVL 19

Expert Comment

ID: 40211007
Is your gridview databound???
If yes, then you should not directly modify the content...
How to programmatically set cell value in DataGridView?

Author Comment

ID: 40212995
it is a telerik gridview

Accepted Solution

r3nder earned 0 total points
ID: 40258607
I gave up on it

Author Closing Comment

ID: 40267264
moved on

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Introduction to Processes

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question