Solved

adding text to  the value of a gridview cell winforms

Posted on 2014-07-21
5
682 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
[X]
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
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to set focus on a dynamic control 18 50
asp.net repeater 2 35
RestClient.cs fails at (HttpWebResponse)request.GetResponse()) 4 50
T-SQL Query 9 35
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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…

732 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