Wednesday, April 16, 2014

(Solved) Error: Uncaught Sys.ArgumentTypeException: Sys.ArgumentTypeException: Object of type 'Sys.Extended.UI.Animation.GenericAnimationBehavior' cannot be converted to type 'Sys.UI.Behavior'. Parameter name: instance in ASP.NET

Error:

Uncaught Sys.ArgumentTypeException: Sys.ArgumentTypeException: Object of type 'Sys.Extended.UI.Animation.GenericAnimationBehavior' cannot be converted to type 'Sys.UI.Behavior'. Parameter name: instance
Solution:

Error resolved by adding ScriptMode="Release" like below
<asp:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Release">
</asp:ScriptManager>
or
<asp:ToolkitScriptManager ID="ToolkitScriptManager2" runat="server"  ScriptMode="Release">
</asp:ToolkitScriptManager>

(Solved) Error: Uncaught TypeError: Cannot read property 'UI' of undefined in ASP.NET

Error:

Uncaught TypeError: Cannot read property 'UI' of undefined
Solution:

Error Resolved by Changing,
<asp:ScriptManger>
to
<asp:ToolScriptManager>

Note: You need to add the latest Ajax Control Toolkit in your Visual Studio Toolbox to access the <asp:ToolScriptManager>

Thursday, April 10, 2014

Project Euler Solution using C#: Problem 16: Power Digit Sum

Problem:

2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 2^1000?
My Solution:

static void Main(string[] args)
{
    int pwr = 1000;
    int sum = 0;
    BigInteger l =(BigInteger)Math.Pow(2, 1000);
    foreach (var item in l.ToString().ToCharArray())
    {
        sum += Int32.Parse(item.ToString());
    }
    Console.WriteLine(sum);
    Console.ReadLine();
}

Note:
You can simplifies the coding :)