Solved

adding text to  the value of a gridview cell winforms

Posted on 2014-07-21
5
667 Views
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

0
Comment
Question by:r3nder
  • 3
5 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
Comment Utility
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?
0
 
LVL 19

Expert Comment

by:Thommy
Comment Utility
Is your gridview databound???
If yes, then you should not directly modify the content...
How to programmatically set cell value in DataGridView?
0
 
LVL 6

Author Comment

by:r3nder
Comment Utility
it is a telerik gridview
0
 
LVL 6

Accepted Solution

by:
r3nder earned 0 total points
Comment Utility
I gave up on it
0
 
LVL 6

Author Closing Comment

by:r3nder
Comment Utility
moved on
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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 …

763 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

9 Experts available now in Live!

Get 1:1 Help Now