Monday, June 17, 2013

ASP.NET send/read JSON array via HiddenField

To send a JSON array in a postback, via hidden field, you can write this simple function. On the postback event you can read your HiddenField like this: Remember to reference the System.Web.Extensions.dll.
GridResponse class is declared as same structure of the JSON:

Monday, March 11, 2013

ASP.NET WebForm ViewBag Property

Recently I developed some classic Asp.Net 3.5 webform pages, I need to use something like ViewBag present in Asp.NET MVC. For this reason I developed this small piece of code that is based on the ViewState. This code must be written in our ASP.NET page; after that should be set with a simple assignment. Obviously the TestClass must be serializable; In the markup of my page, I use the properties as follows:

Friday, February 1, 2013

UAC - Run as Administrator your C# Application

If you need to run your .NET application as Administrator with Visual Studio is very easy.
  • Add new item of type app.manifest to your application
  • Open file and change

    <requestedExecutionLevel level="asInvoker" uiAccess="false" />

    <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
  • Save and build