adding text to  the value of a gridview cell winforms

Posted on 2014-07-21
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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Data is not showing from images 15 37
Close form "before" open 3 24
Get Client IP on RDS - VB.NET 15 25
Not seen Link button 5 14
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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 …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

911 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now