.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

float value not getting rounded

Posted By:      Posted Date: September 14, 2010    Points: 0   Category :ASP.Net
When i am trying to update a text box value to data base ,say 3.1 it is getting updated as 3.09999... when iam running the stored procedure in query analyzer it is updating correctly. When i am updating the same from page , it is  giving this problem. Iam using sql server 2005. Iam using float for this Kindly suggest some solution to overcome this.

View Complete Post

More Related Resource Links

Image or ImageButton rounded corners


Hiiiii Coders,

I just want to make corners of my asp.net image or imagebutton rounded. How can i do so?  

Convert float to String

HI, I am creating a derived column in my workflow. This derived column would have a concatenated value or Currency + [Account No]. Derived column is of type DT_STR. Currency is string (which is fine). I am having trouble converting [Account No] from float to string I tried Currency + (DT_WSTR)[Account No] and Currency + (DT_STR)[Account No] I am a newbie here... so, excuse my stupid question

Having problem with drawing rounded corners with borders using RoundedCornersExtender control

Hi, I have created panel using below syntax <asp:Panel style="z-index:4;top:270px;left:270px;width:320px;height:200px;position:absolute;"  Enabled="True" CssClass="Panel" TabIndex="4" Visible="True" runat="server" ToolTip="" BackColor="" BorderStyle="NotSet" BorderWidth="0px">  <div style="clear:both"></div></asp:Panel> and added rounded corner extened control using <cc1:RoundedCornersExtender Corners="All" runat="server" TargetControlID="panel4" BorderColor="Black" Enabled="True" Radius="10"></cc1:RoundedCornersExtender>Issue: At run time   there is  a gap between border and corners. I am using doctype of this" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >"If i changed the doc type to below "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" ><html xmlns="http://www.w3.org/1999/xhtml" >" its working fine.Is there any solution for this with out changing the doc type?Advanced thanks for your help.Thanks,Charles  

Cannot develop the rounded corners for panel

Hello All, I m trying develop rounded corners for panel. I have gone through this post and did exactly as below:.modalPopup { background-color:transparent; padding:1em 6px; } .modalPopup2 { background-color:#ffffdd; width:270px; vertical-align :top; } .modalBackground { background-color:gray; filter:alpha(opacity=70); opacity:0.7; } Here is the aspx code: <form id="form1" runat="server"> <asp:ScriptManager runat="server" ID="ScriptmanagerTest"></asp:ScriptManager> <div> <asp:LinkButton ID="lnkButton" runat="server">Show Modal popup</asp:LinkButton> <br /> <asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" style="display:none;"> <asp:Panel ID="Panel2" runat="server" Width="334px" CssClass="modalPopup2"> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br /> <asp:Button ID="btnCancel" runat="server" Text="Cancel" /> <asp:Button ID="btnOK" runat="s

Float the Page Title Zone when scrolling down the page?

I would like the horizontal nav and everything above it to float (stay in view) as a user scrolls down the page, like the Ribbon (SharePoint:SPRibbon) does. Basically, this tag <div id="s4-workspace">     /bac

Convert string to float

Hi, Sorry for posting this here. Wasnt getting enough attention in "Getting Started With SQL" forum.   I have a column MTD_PNL of type varchar(255) that may have NULL as a value along with numerical values. I want to write an sql to sum up MTD_PNL grouped by ACCT_NO   SELECT ACCT_NO,  SUM(Convert(FLOAT, ISNULL(MTD_PNL,'0.0'))) AS SUM_MTD_PNL GROUP BY ACCT_NO   The above SQL fails when encounters NULL.

convert string to float when NULL

Hi, I have a column MTD_PNL of type varchar(255) that may have NULL as a value along with numerical values. I want to write an sql to sum up MTD_PNL grouped by ACCT_NO   SELECT ACCT_NO,  SUM(Convert(FLOAT, ISNULL(MTD_PNL,0.0))) AS SUM_MTD_PNL GROUP BY ACCT_NO   The above SQL fails when encounters NULL.  

convert any string to float

hi friends, i am struggling to convert simple string to float here. It is not very simple. I've database which is free text in the front end so people can enter any result. it should be numeric. It can be 0.1 or 3,4 or 33,,22 or 22.2 or 4.5 i can handle all combination when covert into float but when it comes to 3,4 or 22,,33 then it is difficult to conver into float. When i use isnumeric in where clause then it thinks 3,4 is numeric and then it cant convert that text into float. any suggestion? Thanks.

Loading UserControl doesnot render panel properly with rounded corners

Hello folks,I am doing the following steps of code to load a childusercontrol into a parent and load it as a popup.Please help me correct my code below as I am not able to get the rounded corners.Below is my aspx page:<%@ Register Src="~/MessageUC.ascx" TagName="MessageUC" TagPrefix="Ctrl" %> <head runat="server"> <title></title> <link href="Styles/PopUp.css" rel="stylesheet" type="text/css" /> </head> <body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <Ctrl:MessageUC ID="MsgModal" runat="server" /> <asp:Button ID="btnFireOkMessage" runat="server" Text="Show" Height="44px" Width="225px" /> </form> </body> And here is aspx.vbProtected Sub btnFireOkMessage_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnFireOkMessage.Click Dim str As String = "Header" Dim strBody As String = "Body" MsgModal.Show(TestModalPopup.MessageUC.MessageType.Success, str, strBody, 200, 500) End Sub MessageUC.ascx<asp:LinkButton ID="LinkButtonTargetCon

CSS float tables only allowing row of tables start at table header

Hi,I have a page of tables which take in information from the user. I am trying to get the tables to float to the right so I have two rows of tables. But for some reason. Each row of tables starts together. So there is a gap on one of the sides before the next table. Any help would be really appreciated  The CSS is .tableColumnFormat{    padding-top: 3px;    padding-bottom:3px;        width: 180px;    }.labelFormat{    float: left;    padding-left: 5px;    text-align: right;    font-size: medium;    width:180px;    }.tableFormat{        background-color:White;    width: 450px;    border:solid 1.5px #38a7db;        float: left;    margin-bottom:10px;    margin-left:10px;    margin-right:10px;}.tableColumnFormat2{    float:left;        padding-left:5px;    }.headerFormat{    text-align: left;    padding-left: 10px;    color:White;    background-image:url('App_Themes/MasterTheme/Images/table_header_background3.gif');    }

sql 2008 convert nvarchar to float

Hi i need to write a condition in my query where my column value is greater than 2 my column name is sales..and when ever the value in sales in greater then 2 i should get  the O/P but datatype of my  column sales is "nvarchar"  i have used the condition cast(isnull(sales,0) as float)>2, but this didnt work. if some one could help me ...

How to make background-image of table or panel Rounded ?

Hi, I have taken background-image of a Table and Panel, that image's corner is rectangula. How can i make its corners Rounded ? I searched some online resources, images were made rounded, how to make make background-image rounded on the fly ? 

Multi value Parameter Float datatype in Sql Reporting Services2008


Hello there,

I am having a report where i am having 2 parameters to pass the values to Store Procedure in SQL 2008. 

1) @Name Nvarchar(50),

2) @Cost Float

I can able to pass the Multiple values to parameter 1 . From the example below link


but i cannot use that for the float data type. How can i pass multiple values of float data type to my store procedure any help much appriciated..

Thanks Jeevan Dasari....-:)


Rounded Corners on Web Parts


Hi all

I am having some trouble adding rounded corners to my web parts.

I can add rounded corners to three of the corners on the web part chrome by editing the following CSS:

/* Top Left Corner */

.ms-WPHeaderTd {

	background: #04a204 url('/images/tl.gif') no-repeat left top;


/* Top Right Corner */

.ms-WPHeaderTdMenu {

	background: #04a204 url('/images/tr.gif') no-repeat right top;


/* Bottom Left Corner */

.s4-wpcell-plain {

	background: #04a204 url('/images/bl.gif') no-repeat left bottom;


It is the bottom that I am having problems with, I cannot find a way of adding an image to the bottom right corner. CSS3 would be able to do this, but support is thin and SharePoint 2010 doesn't seem to like it in IE9 anyway. I've also found very little online in relation to this problem.

Any help or suggestions would be greatly appreciated.

Many thanks


Entity Framework - stored procedure mapping, excecuting SP with float parameters separated by commas



Im using Entity framework with POCO entity generator template + SQL Server. I have mapping to stored procedure that takes two floats as input.

After executing function from code with two doubles as parameters: 1.23 and 4.56, SQL Profiler shows:

exec storedProcedureName @arg1 = 1,23, @arg2= 4,56

This is causing an error because it looks like that stored procedure takes 4 arguments, but it should take only two and there should be dots insted of commas in these floats.

My SQL Server collation is SQL_Latin1_General_CP1_CI_AS. I tried to set:

           Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
           Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;

in DataContext Constructor, and di

packing an array of float and send them using raw sockets




I need to send a buffer of 20 float values through the net using sockets, so they're picked up by another app. I thought I had it by using 


 private static byte[] SerializeExact(object anything)
      int structsize = Marshal.SizeOf(anything);
      IntPtr buffer = Marshal.AllocHGlobal(structsize);
      Marshal.StructureToPtr(anything, buffer, false);
      var streamdatas = new byte[structsize];
      Marshal.Copy(buffer, streamdatas, 0, structsize);

      return streamdatas;

And then

 var udpClient = new UdpClient();
      byte[] sendBytes = null;

      udpClient.EnableBroadcast = true;
      udpClient.Connect(IPAddress.Broadcast, 4023);
      sendBytes = SerializeExact(pack);
      udpClient.Send(sendBytes, sendBytes.Length);

but found out it does not work (because a float array is not serializable?), is there any other proper way to do it?

thanks in advance.


Find Scale and Precision in Float data type

Is there any way that i can find the scale and precision in float data type column. The table has around 1000 records and for each record, i need to find what is the scale and precision for the column which has float data type.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend