Solved

adding text to  the value of a gridview cell winforms

Posted on 2014-07-21
5
674 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
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?
0
 
LVL 19

Expert Comment

by:Thommy
ID: 40211007
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
ID: 40212995
it is a telerik gridview
0
 
LVL 6

Accepted Solution

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

Author Closing Comment

by:r3nder
ID: 40267264
moved on
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SqlDataBase 7 46
Help with error when uploading excel file 3 26
some keys in my laptop is not working. any suggestion 6 25
Expression Evaluater 3 24
A short article about problems I had with the new location API and permissions in Marshmallow
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

786 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