Posts

Showing posts from January, 2014

Mathematical Expression Evaluation from string in C# using Stack

Mathematical string expression can be evaluate in c# using build in public static double Evaluate(String input)         {             String expression = "(" + input + ")";             Stack<String> operators = new Stack<String>();             Stack<Double> values = new Stack<Double>();             for (int i = 0; i < expression.Length; i++)             {                 String str = expression.Substring(i, 1);                 String prevStr = string.Empty;                 if (i > 1)                     prevStr = expression.Substring(i - 1, 1);                 if (str.E...

WebGrid In MVC3 using Ajax

Image
In MVC3 Webgrid leverages showing data in grid format.This helper is found in the System.Web.Helpers.dl. If your are using Visual Studio 2010 and MVC3 project then this dll is automatically added you need to refer in your controller . Work Flow:  On page load using AJAX Action method that return webgrid JSON is returned Which is placed inside a div to show grid format data. Here is project structure: Index.aspx This page is loaded first time because of default routing you can find in Global.asax routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); Which tell aspxengine that index action in home controller is the default action. <%Html.RenderPartial("WebGridPV"); %> This will load partial view webGridPV , This ...