Tag Archives: affordable ASP.NET Hosting

ByAlexia Pamelov

How to Convert DataTable To JSON String in ASP.NET

CheapWindowsHosting.com | Best and cheap ASP.NET Hosting. First of all you need to create an “ASP.NET Empty Web Site”. Then use the following procedure.

Affiliate-program-01-1

Step 1

Create a ConvertDataTableToJson class in the App_Code folder and provide the following:

Convert DataTable To JSON String.       
    using System.Data 
    using System.Text; 
    public class ConvertDatatableToJson 
    { 
       public string DataTableToJson(DataTable dt) 
       { 
          DataSet ds = new DataSet(); 
          ds.Merge(dt); 
          StringBuilder JsonStr = new StringBuilder(); 
          if (ds != null && ds.Tables[0].Rows.Count > 0) 
          { 
             JsonStr.Append("["); 
             for (int i = 0; i < ds.Tables[0].Rows.Count; i++) 
             { 
                JsonStr.Append("{"); 
                for (int j = 0; j < ds.Tables[0].Columns.Count; j++) 
                { 
                   if (j < ds.Tables[0].Columns.Count - 1) 
                   { 
                      JsonStr.Append("\"" + ds.Tables[0].Columns[j].ColumnName.ToString() + "\":" + "\"" + ds.Tables[0].Rows[i][j].ToString() + "\","); 
                   } 
                   else if (j == ds.Tables[0].Columns.Count - 1) 
                   { 
                      JsonStr.Append("\"" + ds.Tables[0].Columns[j].ColumnName.ToString() + "\":" + "\"" + ds.Tables[0].Rows[i][j].ToString() + "\""); 
                   } 
                } 
                if (i == ds.Tables[0].Rows.Count - 1) 
                { 
                   JsonStr.Append("}"); 
                } 
                else    
                { 
                   JsonStr.Append("},"); 
                } 
             } 
             JsonStr.Append("]"); 
             return JsonStr.ToString(); 
          } 
          else 
          { 
             return null; 
          } 
       }

Step 2

Insert the grid view control into the Default.aspx page then write the following design code:

<asp:GridView ID="ui_grdVw_EmployeeDetail" runat="server" Width="50%" AutoGenerateColumns="false" HeaderStyle-CssClass="pageheading"> 
    <Columns> 
    <asp:TemplateField HeaderText="S.NO"> 
    <ItemTemplate> 
    <%#Container.DataItemIndex+1 %> 
    </ItemTemplate> 
    </asp:TemplateField> 
    <asp:TemplateField HeaderText="Employee ID"> 
    <ItemTemplate> 
    <asp:Label ID="ui_lbl_EmployeeID" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Emp_id") %>'></asp:Label> 
    </ItemTemplate> 
    </asp:TemplateField> 
    <asp:TemplateField HeaderText="Employee Name"> 
    <ItemTemplate> 
    <asp:Label ID="ui_lbl_EmployeeName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Emp_Name") %>'></asp:Label> 
    </ItemTemplate> 
    </asp:TemplateField> 
    <asp:TemplateField HeaderText="Employee Post"> 
    <ItemTemplate> 
    <asp:Label ID="ui_lbl_EmpJob" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Emp_job") %>'></asp:Label> 
    </ItemTemplate> 
    </asp:TemplateField> 
    <asp:TemplateField HeaderText="Department"> 
    <ItemTemplate> 
    <asp:Label ID="ui_lbl_Department" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Emp_Dep") %>'></asp:Label> 
    </ItemTemplate> 
    </asp:TemplateField> 
    </Columns> 
    </asp:GridView> 
    <br /> 
    <asp:Button ID="ui_btn_Convert1" runat="server" Text="Manually Convert To Json" OnClick="ui_btn_Convert1_Click" /><br /><br /><br /> 
    <asp:Label ID="ui_lbl_JsonString1" runat="server"></asp:Label>

Step 3

Now, open the Deafult.asps.cs then write the following code:

using System; 
   using System.Data; 
   public partial class _Default : System.Web.UI.Page 
   { 
      #region Global Variable 
      DataTable dt; 
      ConvertDatatableToJson dtJ; 
      string JsonString = string.Empty;    
      #endregion 
       
      protected void Page_Load(object sender, EventArgs e) 
      { 
         if (!IsPostBack) 
         { 
            ui_grdvw_EmployeeDetail_Bind(); 
         } 
      }       
      protected void ui_grdvw_EmployeeDetail_Bind() 
      { 
         dt = new DataTable(); 
         EmployeeRecord employeeRecord = new EmployeeRecord(); 
         dt = employeeRecord.EmpRecord(); 
         ViewState["dt"] = dt; 
         ui_grdVw_EmployeeDetail.DataSource = dt; 
         ui_grdVw_EmployeeDetail.DataBind(); 
      }       
      protected void ui_btn_Convert1_Click(object sender, EventArgs e) 
      { 
         dtJ = new ConvertDatatableToJson(); 
         JsonString = dtJ.DataTableToJson((DataTable)ViewState["dt"]); 
         ui_lbl_JsonString1.Text = JsonString; 
      } 
   }

Step 4

Press F5, run the project.

Now, convert the DataTable to a JSON string using the newtonsoft DLL.

Step 1

Download the Newtonsoft DLL and move it to the ASP.Net project’s bin folder.

Step 2

Then, insert a button and label UI Control in the Deafult.aspx page as in the following:

<asp:Button ID="iu_btn_Convert2" runat="server" Text="Newtonsoft Convert To Json" OnClick="iu_btn_Convert2_Click" /> 
    <br /> 
    <br /> 
    <asp:Label ID="ui_lbl_JsonString2" runat="server"></asp:Label>

Step 3

Now, write the following code in Default.aspx.cs:
using this namespace

using Newtonsoft.Json;

 And then:

protected void iu_btn_Convert2_Click(object sender, EventArgs e) 
    { 
       dt = (DataTable)ViewState["dt"]; 
       JsonString = JsonConvert.SerializeObject((DataTable)ViewState["dt"]); 
       ui_lbl_JsonString2.Text = JsonString; 
    }

 Now, run the project and click on the Newtonsoft Convert to JSON .

Best OFFER Recommended ASP.NET Hosting ! Click Here

ByAlexia Pamelov

How to Increase The Overall Performance of ASP.NET in your App

CheapWindowsHosting.com | Best and cheap ASP.NET hosting. ASP.NET is really a framework for creating net applications created by Microsoft. Initially the technologies. NET is the successor of ASP which is also a computer software product from Microsoft. With .NET ASP gives a platform for developers to design and create dynamic websites and net portals.

112414-websecurity-850x476

You will find certain items that ought to be regarded as when improving the performance from the application in developing a net application. Here are a few of the tips to improve the performance of ASP.NET 4.5.1:

Turn off Session State

Disable session state if you do not need, as this can improve the all round efficiency. By default the session state is always active. However, you’ll be able to disable session state for any specific pages.

Turn off Tracing

If tracing is enabled, tracing will add a whole lot of overhead in producing applications. Though tracing is actually a useful function inside the development because it enables developers to track and trace application sequence, tracing may be turned off, unless you want to monitor the trace logging.

Avoid Page Validation Server (Steer clear of Server-side Validation)

Within this case, must be attempted use of client-side validation, not the server side. Server-side validation will consume a lot of sources around the server which can have an effect on application efficiency.\

Stay away from Exceptions (Avoid Exceptions)

Exceptions may be 1 of the biggest resource eater which resulted within the lower of web applications and windows applications. Therefore, it is much better to prevent the use and handling of exceptions which can be not beneficial.

Avoid frequent connections for the database (Steer clear of Frequent Calls to Database)

Connections are frequently made for the database can devote time response and resources (resources). This can be avoided by utilizing batch processing. Producing the minimum database connection as a connection is opened and not closed, may cause efficiency slowdown.

Stay away from utilizing Recursive Functions and Nested Loops

To improve application performance, attempt to always steer clear of utilizing nested loops and recursive functions simply because these functions consume a whole lot of memory.

Turn off the View State

In ASP.NET, the default view state will probably be active and will slow down the website. So if you don’t use a kind postback, it’s much better to disable view state.

Use Caching

Web page caching could be employed to get a particular period of time and towards the required duration will not visit the server and are served from the cache. In the case of static internet pages and dynamic, Partial Caching [Fragment Caching] may be utilized to break into a couple of pages a user control.

Best OFFER Recommended ASP.NET Hosting ! Click Here

ByAlexia Pamelov

Cheap Windows ASP.NET Hosting – Tips You Shall Know on Choosing ASP.NET Hosting

CheapWindowsHosting.com | Best and cheap ASP.NET Hosting. Being devoted into ASP.NET development and ASP.NET website hosting for a couple of years, we know the secrets hidden in the ASP.NET hosting advertisement and how difficult to find a trusted and cost effective ASP.NET hosting provider. Thus, we would like to show you the top 10 tips on choosing ASP.NET hosting providers before starting with our topic.

  1. MS SQL Server database edition and limitation. The latest version of MSSQL 2012 are preferred.
  2. .NET Framework versions. Does it support the version used for your website?
  3. ASP.NET MVC versions. Does it support the version used for your website if you’re using ASP.NET MVC technology?
  4. Does it provide the dedicated application pool so that you won’t be affected by your neighbors?
  5. How long the IIS is set to recycle your website – usually 30 minutes at least is required.
  6. What’s the maximum dedicated memory allowed for the ASP.NET websites?
  7. The hosting provider needs to have the rich experiences and knowledge of how to ensure the high-quality ASP.NET hosting. Besides, it is great that they have got plenty of positive feedbacks from real customers and have been trusted and recommended by a lot of authorities, communities and hosting review sites.
  8. The ASP.NET hosting needs to ensure a high level of hosting reliability with at least 99.9% uptime. Note that this can be achieved with the utilization of cutting-edge data centers, solid server machines and no overselling practice. In addition, some confident web hosts even claim to give you some compensations if they fail to meet their promised uptime track record.
  9. The hosting speed is also pretty essential. After all, your readers can be frustrating if they find it takes a long time for accessing your website. In this case, you need to figure out that whether your web host can ensure the peak performance with no more than 3 seconds for page loading and 400 ms for the server response.
  10. The web host needs to ensure the all-time-rounded technical support to assist you 24 hours a day and 7 days a week. Also, their support staffs need to have the rich knowledge about ASP.NET hosting and related applications.

General Knowledge about ASP.NET

ASP.NET is the server-side online application framework coming with the open source nature. It is designed with the purpose of web development and dynamic webpages production mainly. In addition, developed by Microsoft, ASP.NET has been used by a lot of programmers for the creation of complicated websites, online applications and add-on services.

In fact, ASP.NET has been released since January 2002, which is the successor to the Active Server Pages technology of Microsoft. As it is built based on the Common Language Runtime, developers and programmers can write the ASP.NET code with the help of .NET language.

Cheap Windows ASP.NET Hosting

ASPHostPortal  Cheap Windows ASP.NET Hosting

Why we choose ASPHostPortal for the cheap ASP.NET hosting ?

ASPHostPortal.com, a Microsoft Golden hosting partner has been offering well priced Windows and ASP.NET hosting plans for many years. Founded in 2008 and operated in New York, US. ASPHostPortal.com has become an important resource for cutting-edge, high-value hosting solutions. The company also offers low priced enterprise-level hosting plans by focusing their resources on needs by ASP.NET Windows’s developers.

This company supports almost all the latest ASP.NET technology and provides plenty of server resources for every hosting account. Below are the list of key features, but definitely it provides more:

aspportalASPHostPortal.com | The cheap ASP.NET  Hosting Provider. Cheap and affordable Hosting features including:

ASPHostPortal.com


  1. Unlimited Sites, 5 GB Disk Space,  60 GB Bandwidth only $ 5.00/Mo
  2. IIS 8.5 with URL-Rewrite, ASP.NET MVC Framework.
  3. Compatible with nopCommerce, DNN, Magento and more other ASP.NET web applications.
  4. 100% Satisfaction Promise with 30 Days Money Back Guarantee!

HostForLIFE  Affordable ASP.NET  Hosting

hflHostForLIFE.eu | Professional ASP.NET Provider & fully ASP.NET support. Customers can easily deploy the most popular ASP.NET, CMS & Blog system such as BlogEngine, DotNetNuke. The best ASP.NET hosting feature including :

HostForLIFE.eu


  1. Unlimited Domain, Unlimited Disk Space, Unlimited Bandwidth only €3.00/Mo
  2. IIS 8.5 with URL-Rewrite, ASP.NET MVC Framework.
  3. 100% Satisfaction Promise with 30 Days Money Back Guarantee!

 UKWindowsHostASP.NET Best ASP.NET  Hosting

ukwinhostUKWindowsHostASP.NET | The best ASP.NET Provider & fully ASP.NET support. One of top and recommended ASP.NET Hosting Providers ! ASP.NET Hosting feature plan including:
 

  1. Unlimited Domains
  2. Dedicated Pool
  3. 99.99% Uptime Guarantee & 24/7 Live Support
  4. Support WordPress, Drupal and etc
  5. FREE Instant Setup