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

Top 5 Contributors of the Month
Post New Web Links

whats wrong with this? decimal or whole number?!

Posted By:      Posted Date: October 27, 2010    Points: 0   Category :ASP.Net

here is my code, i am getting the data types wrong i think.

label 51 is a whole number from database, label52 could be a decimal number after the division is applied to label 51.

label 53 will be a decimal

label 54 will be a decimal, but id like to show it to the nearest whole number...

how can i get this to work? thanks!

FormView Formview1 = (FormView)sender;
        Label Label51 = Formview1.FindControl("Label51") as Label;
        Label Label52 = Formview1.FindControl("Label52") as Label;
        Label Label53 = Formview1.FindControl("Label53") as Label;
        Label Label54 = Formview1.FindControl("Label54") as Label;


        Label52.Text = (int.Parse(Label51.Text) / Convert.ToInt32("144")).ToString();
       Label53.Text = (double.Parse(Label52.Text) * Convert.ToInt32("100")).ToString();
        Label54.Text = (Convert.ToInt32("100") - int.Parse(Label53.Text)).ToString();

View Complete Post

More Related Resource Links

Whats wrong with this statement


Im trying to updated some old ASP pages with some new .net pages and cant seem to get this update statement to work. I need to update the current ASP code below and then once thats working im going to use that same statement in a procedure for all our new .Net pages..

So can anyone see what im doing wrong by inserting the 2nd column to the update statement?

strSqual = "update tas set date_completed='" & TransDate & ", trans_id=" & InsertedTransID & "' where date_completed is null and sercontract_id="& strContractID & " and DATEDIFF(dd,task_due_date,'" & strProcDate & "')<=14"


I am trying to add an extra column to the update, but not sure if the syntax is correct.

Whats wrong with this code, im getting blue line under the createStatus next the switch

Error message: Use of unassigned local variable 'createStatus'
            MembershipCreateStatus createStatus;
            MembershipUser newUser = Membership.CreateUser(Username.Text, Password.Text, Email.Text);

            switch (createStatus)
                case MembershipCreateStatus.Success:
                    this.CreateAccountResults.Text = "The user account was successfully created!";
                case MembershipCreateStatus.DuplicateUserName:
                    this.CreateAccountResults.Text = "There already exists a user with this username.";
                case MembershipCreateStatus.DuplicateEmail:
                    this.CreateAccountResults.Text = "There already exists a user with this email address.";
                case MembershipCreateStatus.InvalidEmail:
                    this.CreateAccountResults.Text = "There email address you provided in invalid.";
                case MembershipCreateStatus.InvalidPassword:
                    this.CreateAccountResults.Text = "The password you provided is invalid. It must be seven characters long and have at least one non-a

datagrid item.ItemIndex keep selecting the wrong row number

I apologize in advance for my poor english:1. I have a dropdownList within my datagrid and its already populated fine (22 rows in my datagrid)2. The select item for the 21 row is the same as the select item of the 22 row3. When trying to do selectedIndexChange for the 22 row, it didn't seem to work. The error: Dim ddl As DropDownList = CType(sender, DropDownList)Dim dgi As DataGridItem = CType(ddl.Parent.Parent, DataGridItem)Dim rowID As Integer = dgi.ItemIndex The rowID keep staying at 20 even though the selectedIndexChanged is happening in row 22( ie. rowID should be 21)Does anyone seen this problem before??

Loading Decimal Number From Excel into SQL Server 2005 using SSIS Package

If you have an excel spreadsheet that displays a number .02 (because it is formated) but internally it is stored as .2654329 and you want to load .2654329 how can you do that in the SSIS package?  When we load the spreadsheet it is loading .02.  Is there some kind of option in the SSIS package to tell the package to load the internal number?lcerni

Whats wrong with my ExecuteScalar() Code ? - C#.net - Plz Help !

Hi,I downloaded OracleHelper & i'm using it....Now i want to insert a row into a table named 'Sample'.I have 2 textboxes and when i click on the button i need to insert the values from 2 textboxes into the table & here is my code....OracleHelper.ExecuteNonQuery(connectionString, CommandType.Text,"insert into sample (id,name) values(?id,?name);", new OracleParameter("@id", OracleDbType.Int32, Int32.Parse(TextBox1.Text)), new OracleParameter("@name",OracleDbType.Varchar2,20,(TextBox2.Text).ToString()));The error i get is,ORA-00911: invalid character and it shows the error is innew OracleParameter("@name",OracleDbType.Varchar2,20,(TextBox2.Text).ToString())Please guide me !

Whats wrong with my style?

Im getting a compile error "Error 6 '12' is not a valid value for the 'System.Windows.Documents.TextElement.FontSize'" when I apply my style to a label.  It "looks right", I could use someone elses opinion what is wrong: <Window x:Class="MoneyClient.RevisedScreen" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:net="clr-namespace:System;assembly=mscorlib" Title="Revised Screen" Height="480" Width="600"> <Window.Resources> <net:Int32 x:Key="titleFontSize">12</net:Int32> <Style x:Key="headerStyle" TargetType="Label"> <Setter Property="FontSize" Value="{StaticResource titleFontSize}" /> <Setter Property="FontWeight" Value="Bold" /> </Style> </Window.Resources> <Label Content="Setup" FontSize="12" FontWeight="Bold" Style="{StaticResource headerStyle}"/> </Window> Thnx Mat

Suffereing with text formatting, whats wrong?

I am outputting a histogram and can't get the labeling of the cells formatted correctly. I want the numbers printed at the bottom of each cell to be centered, but as you can see they are left justified. At the same time the very left number I oversized to see what would happen. This widens the size of the graphic bin which I don't want, I would rather crop the number. What am I missing here, what attributes are missing? I have been playing with this since yesterday and it is driving me nutts. <hbox height="200" width="100" style="border: 2px inset -moz-dialog; margin: 4px;"> <box id="0" flex="1" align="end" width="5%" style="background: -moz-linear-gradient(left, red,red 10%);">2900</box> <box id="1" flex="1" align="end" width="5%" style="background: -moz-linear-gradient(left, red,red 11%);">3</box> <box id="2" flex="1" align="end" width="5%" style="background: -moz-linear-gradient(left, yellow,yellow 12%);">1</box> <box id="3" flex="1" align="end" width="5%" style="background: -moz-linear-gradient(left, yellow,yellow 13%);">1</box> Etc </hbox>

Whats wrong with this condition

I have this condition in my page_load event and it seems to be ignored, i do have it OUTSIDE of my !IsPostback condition. I need to check those sessions EVERYTIME you get to the page, regardless if its the first time on the page or if you have been on the page / site for a while.. those sessions are being set on a different page and this particular page needs those variables in order to work.. so if they dont exist they need to be sent back to the first page so they can be set.   if (Session["ss_t_id"] == null || Session["ss_t_type"] == null) { Response.Redirect("/", false); } ============================================== if (!IsPostBack) { ddlReport.SelectedIndex = 1; if (ddlReport.SelectedValue == "0") { lvReport.Visible = false; filterddl.Visible = false; prtPage.Visible = false; prtAll.Visible = false; } else { DropDownLists are being set in this portion } }  

View All Site Content Showing the wrong number of items

NOTE:  Similar post also had no answer: http://social.msdn.microsoft.com/Forums/en-US/sharepointecm/thread/f775ba0d-648f-4be3-9017-78539915b281/ I am the Site Collection Administrator/and also tried logging in using Farm Account.  I go into View All Site Content and I show 15 documents.  When you actually go to the All Items view (and I double-checked, no filtering), you only find 9 documents.  Versioning is not turned on.  I am a developer, so I also used the Web Service to try to troubleshoot.  The Lists.asmx web service shows an Item Count of 15 using the GetList method.  However, using the GetListItems method, the item Count reports 9 items, which is what I see in my browser. Is there an stsadm command that I can run that will "true up" this number being reported in View All Site Content? Thanks in advance. - Update -  MOSS 2007 v 3.0 server farm.

Cumulative Update 5 - wrong SQL 2008 version number


Hi all,

I installed Service Pack 1 for SQL 2008 on one of my servers. This server has multiple instances. In this case, it is the instance "SHAREPOINT2010" that is giving me difficulties.

For Sharepoint 2010, we need to install cumulative update 5. This update fails due to the fact I do not have the correct SQL version. It is expecting version 10.0.2531 (SP1), but it says I have the 10.0.1600 (RTM). When I check in my management studio and via the @@version, I do see the confirmation I have version 10.0.2531. (also see attached screenshot).

Does anyone know why the cumulative update fails to see the correct server version ? If I try to install it on another SQL 2008 SP1, it works fine..;

Thank you !



screenshot sql version

sharepoint number field in list comes with decimal places in dispform


hello guys,

 the sharepoint number field in list comes with 2 decimal places in dispform, like

when I enter number like 12 on new form, when I open the dispform, it shows 12.00

I tried to keep the decimal places to 0  but it didn't work.

Do you guys know anything about this one. I don't want to make it a single line of text.

Can anybody tell me whats wrong in this query?


Hi, this is the query for SsisConfiguration. i have done few changes in the main package so i have to change the data files path. Can anybody tell me if this is correct? i have 5 child packages so do i have to do the same thing for all packages?

USE SsisLogs



IF  EXISTS (SELECT * FROM [SsisLogs].[audit].[SSISConfig]
UPDATE SsisLogs.Audit.SsisConfig
SET ConfiguredValue = '\\uafc.com\ua\MH\DIRFILEDEV\CHG67570\Data'
WHERE ConfigurationFilter = 'FileLocation_RxCuiToNdc_Load'
IF NOT EXISTS (SELECT * FROM [SsisLogs].[audit].[SSISConfig]

Whats wrong with this SelectNodes string?


I can't fingure out what I'm doing wrong here.

This is a minimized version of how the XML looks like: 

<?xml version="1.0"?>
    <title> </title>
    <description> </description>
        <rdf:li rdf:resource="http://magicplus.karolinska.se/pc/driftrapportlista.asp" />
        <rdf:li rdf:resource="http://magicplus.karolinska.se/pc/driftrapportlista.asp" />
        <rdf:li rdf:resource="http://magicplus.karolinska.se/pc/driftrapportlista.asp" />
        <rdf:li rdf:resource="http://magicplus.karolinska.se/pc/driftrapportlista.asp" />
        <rdf:li rdf:resource="http://magicplus.karolinska.se/pc/driftrapportlista.asp" />
        <rdf:li rdf:resource="http://magicplus.karolinska.se/pc/driftrapportlista.asp" />
  <item rdf:about="http://magicplus.karolinska.se/pc/driftrapportlista.asp">

Whats wrong with this syntax


I had issues with updating database with .xls  and .csv files, but got it working.. I need more control over the csv upload, so i was trying a few things i found online for connecting to the file similar to the excel file that works great.


I have the follow connections to an xls and csv and the csv logic throws an exception that it cant find the file, even though it was uploaded successfully prior to the reader.

Here is the logic for an excel file and then for the csv, both are identical except for the Extended Properties on the connectionstring, so not sure why its giving that error, the file is uploaded to the folder fine and exists prior to the reader.

{"'C:\\\\inetpub\\wwwroot\\SyNet\\TestSecurity\\Sion\\Sion\\Data\\testAPconfig.csv' is not a valid path.  Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides."}


Connection String for .CSV

                            OleDbConnection csvConnection = new OleDbConnection();
                            csvConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
                            "Data Source=" + fullName + ";Extended Properties=\"text;HDR=Yes;FMT=Delimited;\"";


sql server 2005 on windows 7 .. Whats wrong?


Hi ..

I downloaded Sql server 2005 on Windows 7 And downloaded Sp3  but it is just giving me the Configration tools without the Database Server ..

what the problem please??!!

if any one can help I will be so greatfull ..


Whats wrong with my code?




TABLE [dbo].[TABCPFRF_new](

[IdRegistro] [int]


How to convert a decimal number field to C#


I have a SPList with calculated numeric field with 1 decimal digit. Having trouble to convert it to c#. The string representation is like this : "float;2.1000"

Is there a SP builtin class or conversion function to handle this, or do I have to parse this manually?


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