Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6935907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:09:52+00:00 2026-05-27T12:09:52+00:00

I think this should be a pretty easy question to answer but I can’t

  • 0

I think this should be a pretty easy question to answer but I can’t seem to figure it out.
I am adding text to labels from a sqldatasource in c#. All of that works, but I want to be able to format the text. I want to 1) be able to change the format to 0.00 (instead of a string of decimals) and I would also like to be able to add words before the text. I assume I need to somehow use the string.format command but can’t figure out how to work it in. Any help would be greatly appreciated. Here’s my code below:

DataView dvSql = (DataView)DeskSummary.Select(DataSourceSelectArguments.Empty);
foreach (DataRowView drvSql in dvSql)
{

    Desk.Text = drvSql["Deskname"].ToString();                  
    MarginLabel.Text = drvSql["margin"].ToString();
    CurrentCI.Text = drvSql["comp_index_primarycomp"].ToString();
    WalMartCurrentCI.Text = drvSql["comp_index_walmart"].ToString();
    ForecastMargin.Text = drvSql["margin_forecast"].ToString();
    WalMartForecastCI.Text = drvSql["comp_index_walmart_forecast"].ToString();
    ForecastCI.Text = drvSql["comp_index_primarycomp_forecast"].ToString();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:09:53+00:00Added an answer on May 27, 2026 at 12:09 pm

    You can pass the format argument to the ToString() method like so:

    MarginLabel.Text = drvSql["margin"].ToString("0.00");
    

    However, as you said you wanted to prepend some text. Therefore, I recommend:

    MarginLabel.Text = String.Format("Prepended text {0:0.00}", drvSql["margin"]);
    

    Note: I just picked one of your labels; I’m not sure which ones get special formatting treatment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think that this should be pretty easy but I'm not quite sure how
This should be pretty straightforward I would think. I have this string: [quote=Joe Johnson|1]Hi![/quote]
I think this should be simple but I am having some difficulty implementing it.
I think this should be simple, but im having a real hard time finding
How can I force validation when user clicks button? One would think this should
Dear all,Now i have this question in my java program,I think it should be
This seems like it should be an easy thing to do, but for the
I am getting to know boost::variant. I think this example should work. #include <boost/fusion/sequence.hpp>
sed 's/^\(\h*\)\(.*\)$/\1<!-- \2 -->/' web.xml I think that this should take this xml: <a>
This might be something very straight forward and I really think it should work

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.