ASP.NET 4.5 and ASP.NET Core 1 Hosting BLOG

Tutorial and Articles about ASP.NET 4.0 and the latest ASP.NET 4.5 Hosting

ASP.NE Hosting - ASPHostPortal.com :: Easy Ways to dynamically update web config file in asp.net?

clock September 30, 2016 19:48 by author Dan

I want to configure my web config connection string in my aspx page. That mean I want to change my web.config file dynamically. User can change the connection string any time without touching the server. For that the below asp.net c# code will help you to change connection string , appsetting information and ect..  in dynamically.

private void SetConfigSettings()
        {
            try
            {
                // App setting settings
                System.Configuration.Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");

                //APPsetting value change
                System.Configuration.KeyValueConfigurationElement setting = config.AppSettings.Settings["SupportFormat"];
                if (null != setting)
                    config.AppSettings.Settings["SupportFormat"].Value = txtFormat.Text.Trim();

                //APPsetting value change
                System.Configuration.KeyValueConfigurationElement Pathsetting = config.AppSettings.Settings["Path"];
                if (null != Pathsetting)
                    config.AppSettings.Settings["Path"].Value = txtPath.Text.Trim();


                //Connection string changes
                string newConnectionString = "Data Source=" + txtServer.Text + ";Initial Catalog='" + txtDatabaseName.Text.Replace("'", "") + "';User ID=" + txtUserName.Text + ";Password=" + txtPassword.Text + ";Persist Security Info=True;";

                //Configuration openWebConfiguration = WebConfigurationManager.OpenWebConfiguration("~");
                ConnectionStringsSection sections = config.GetSection("connectionStrings") as ConnectionStringsSection;
                if (sections != null)
                {
                    sections.ConnectionStrings["ConString"].ConnectionString = newConnectionString;
                    ConfigurationManager.RefreshSection("ConString");

                }
                config.Save();

                lblMSG.Text = "Updated successfully!!!";
                lblMSG.ForeColor = Color.Green;
            }
            catch (System.Exception exc)
            {
                lblMSG.Text = exc.Message;
                lblMSG.ForeColor = Color.Red;
            }
        }

Best ASP.NET Hosting Recommendation

ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers ASP.NET hosting starts from $1/month only. They also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable ASP.NET Hosting, ASPHostPortal.com should be your best choice.



ASP.NET Hosting - ASPHostPortal.com :: How to Write content from ASP.NET to Excel

clock September 27, 2016 20:25 by author Armend

How to Write content from ASP.NET to Excel

The following program shows how to write the GridView content to an Excel file and save to a desired location. Here we are using the FileStream class to write the content to a local system.

FileStream fStream = new FileStream("c:\\data.xls", FileMode.Create);

The following method will confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time.

 

public override void VerifyRenderingInServerForm(Control control)
  {
  }

Sometimes you will get an exception unless you are not declared the above method in your program the exception shows like :

System.Web.HttpException: Control 'GridView1' of type 'GridView' must be placed inside a form tag with runat=server..

Default.aspx

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" />
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
    ConnectionString="<%$ ConnectionStrings:SQLDbConnection %>"
    SelectCommand="select * from stores" />
    </div>
    <asp:Button ID="Button1" runat="server" onclick="Button1_Click"
    Text="Export to Excel" Width="117px" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Label ID="Label1" runat="server" Text="Message : "></asp:Label>
    </form>
</body>
</html>

 

Best ASP.NET Hosting Recommendation

ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers ASP.NET hosting starts from $1/month only. They also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable ASP.NET Hosting, ASPHostPortal.com should be your best choice.



ASPHostPortal.com Announces Moodle 3.1.1 Hosting Solution

clock September 27, 2016 19:54 by author Dan

Established in 2008, ASPHostPortal.com is one of the leading ASP.NET hosting provider offering quality Moodle Hosting with premium support. We maintains and operates its own network. We only use the best hardware, super fast network, covered by 24/7 Support Team. Our commitment to excellence in customer support and system performance is truly what sets us apart from the competition. Now, we offer reliable Moodle 3.1.1 hosting with 99,9% uptime guarantee.

Moodle is an open source Learning Management System, used extensively in businesses. Moodle stands for "Modular Object-Oriented Dynamic Learning Environment." It is very popular with elearning developers and educators. With an impressive array of features, Moodle is capable of addressing many instructional issues.

Moodle makes it easy and convenient to provide online assessment schemes. You can readily find tracking tools and devices to effectively monitor students' performance on real-time and individual basis. Comparison among students can be done pretty thoroughly.

ASPHostPortal.com strongly believe in high quality standards and Hence you’ll always find their services better than every other host in this industry. We offer Moodle 3.1.1 hosting with affordable price, a lot of features, 99.99% uptime guarantee, 24/7 support, and 30 days money back guarantee. We strive to make sure that all customers have the finest web-hosting experience as possible. To learn more about our Moodle 3.1.1 Hosting, please visit http://asphostportal.com/Moodle-3-1-1-Hosting

About ASPHostPortal.com:
ASPHostPortal.com is The Best, Cheap and Recommended ASP.NET & Linux Hosting. ASPHostPortal.com has ability to support the latest Microsoft, ASP.NET, and Linux technology, such as: such as: WebMatrix, Web Deploy, Visual Studio, Latest ASP.NET Version, Latest ASP.NET MVC Version, Silverlight and Visual Studio Light Switch, Latest MySql version, Latest PHPMyAdmin, Support PHP, etc. Their service includes shared hosting, reseller hosting, and Sharepoint hosting, with speciality in ASP.NET, SQL Server, and Linux solutions. Protection, trustworthiness, and performance are at the core of hosting operations to make certain every website and software hosted is so secured and performs at the best possible level.



ASP.NET Core 1.0 Hosting - ASPHostPortal.com :: Easy Ways to Create CheckBox Control in ASP.NET

clock September 26, 2016 20:42 by author Dan

CheckBox is an asp.net web server control. checkbox allow web site visitor to select (checked) a true or false condition. so the checkbox control create a checkbox on web forms page which allow user to switch between a true or false state. checkbox Text property create a caption for it. we can left or right align caption by using checkbox TextAlign property.

the checkbox control has many properties that help us to change looks and style such as ForeColor, BorderColor, BackColor, BorderStyle, BorderWidth, CssClass, EnableTheming, Font, Height, SkinID, ToolTip, Width etc.

if we want to determine whether checkbox is checked (selected) then we need to test the checkbox Checked property. checkbox AutoPostBack property value true enable automatic posting to server. checkbox CheckedChanged event raised when someone change the checkbox true or false state. .net developers can write an event handler for CheckedChanged event. using CheckedChanged event we can know the checkbox current state and can perform any task when page post to server.

the following example demonstarte us how to use checkbox control in asp.net. here we create a web form with a Label and two checkbox control. when someone check the first checkbox then the label show a message that he checked first checkbox. the second checkbox programmatically checked when user checked the first checkbox.

<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">
    protected void CheckBox1_CheckChanged(object sender, System.EventArgs e) {

        if (CheckBox1.Checked == true) {
            Label1.Text = "WOW! You are a member of an asp.net user group.";
            Label1.ForeColor = System.Drawing.Color.Green;
        }
        else{
            Label1.Text = "You are not a member of any asp.net user group.";
            Label1.ForeColor = System.Drawing.Color.Crimson;
        }
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>How to use CheckBox control in asp.net</title>
    </head>
  
<body style="padding:25px">
    <form id="form1" runat="server">
    <div>
        <h2 style="color:MidnightBlue; font-style:italic;">     
            How to use CheckBox control
        </h2>     
        <hr width="450" align="left" color="Gainsboro" />
        <asp:Label
            ID="Label1"
            runat="server"
            Font-Bold="true"
            Font-Names="Comic Sans MS"
            ForeColor="Crimson"
            Font-Italic="true"
            Font-Size="X-Large"
            Width="350"
            />
        <br /><br />
        <asp:CheckBox
            ID="CheckBox1"
            runat="server"
            Text="Are you an asp.net user group member?"
            OnCheckedChanged="CheckBox1_CheckChanged"
            AutoPostBack="true"
            Font-Names="Serif"
            Font-Size="X-Large"
            />
    </div>
    </form>
</body>
</html>

Best ASP.NET Hosting Recommendation

ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers ASP.NET hosting starts from $1/month only. They also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable ASP.NET Hosting, ASPHostPortal.com should be your best choice.



ASPHostPortal.com Announces Joomla 3.6.2 Hosting Solution

clock September 20, 2016 20:31 by author Dan

Today, ASPHostPortal.com provides reliable Joomla 3.6.2 hosting plans on high performance servers and high-speed internet connection in the world. We are using SSD's for storage, which provides much higher performance in terms of I/O and data transfer speed. We strongly believe in high quality standards and Hence, you’ll always find our services better than every other host in this industry. Therefore, our focus is always aimed at making sure customers are constantly able to achieve optimal performance and usability with all of the services that we offer.

Joomla is a very competitive tool when websites related to eCommerce, online newspapers and so on, need to be developed. Object oriented programming techniques are employed by Joomla so relevant code can be programmed. This is what makes Joomla a preferable choice as a content management system that a broad spectrum of companies seem to be in need of these days. Even developers prefer Joomla because it can be deployed in a relatively small time frame.

With Joomla, developers do not have to copy pages, or migrate a website to its new look, which is quite complicated. Joomla has a tremendous community of developers. Joomla is currently one of the most widely used content management systems and this is the reason Joomla website development is used so widely. Some days ago, Joomla has been released their new Joomla 3.6.2 version with the new features and fixing some bugs from earlier versions.

ASPHostPortal.com has served people since 2008 and we know how to deliver Powerful, Fast and Reliable Joomla 3.6.2 Hosting for all customers. We offer Joomla 3.6.2 hosting with affordable price, a lot of features, 99.99% uptime guarantee, 24/7 support, and 30 days money back guarantee. We strive to make sure that all customers have the finest web-hosting experience as possible. To learn more about our Joomla 3.6.2 Hosting, please visit http://asphostportal.com/Joomla-3-6-2-Hosting

About ASPHostPortal.com:
ASPHostPortal.com is The Best, Cheap and Recommended ASP.NET & Linux Hosting. ASPHostPortal.com has ability to support the latest Microsoft, ASP.NET, and Linux technology, such as: such as: WebMatrix, Web Deploy, Visual Studio, Latest ASP.NET Version, Latest ASP.NET MVC Version, Silverlight and Visual Studio Light Switch, Latest MySql version, Latest PHPMyAdmin, Support PHP, etc. Their service includes shared hosting, reseller hosting, and Sharepoint hosting, with speciality in ASP.NET, SQL Server, and Linux solutions. Protection, trustworthiness, and performance are at the core of hosting operations to make certain every website and software hosted is so secured and performs at the best possible level.



ASP.NET Hosting - ASPHostPortal.com :: How to Add Controls to an ASP.NET Web Page Programmatically

clock September 20, 2016 19:39 by author Armend

How to Add Controls to an ASP.NET Web Page Programmatically

In order to programmatically add a control to a page, there must be a container for the new control. For example, if you are creating table rows, the container is the table. If there is no obvious control to act as container, you can use a PlaceHolder or Panel Web server control.

In some instances, you might want to create both static text and controls. To create static text, you can use either a Literal or a Label Web server control. You can then add these controls to the container as you would any other control. For information about view state in controls created at run time, see Dynamic Web Server Controls and View State.

To add a control to an ASP.NET Web page programmatically

  • Create an instance of the control and set its properties, as shown in the following example:

Label myLabel = new Label();
myLabel.Text = "Sample Label";

  • Add the new control to the Controls collection of a container already on the page, as shown in the following example:

Panel Panel1= new Panel();
Panel1.Controls.Add(myLabel);

Note

Because the Controls property is a collection, you can use the AddAt method to place the new control at a specific location — for example, in front of other controls. However, this can introduce errors into the page. For details, see Dynamic Web Server Controls and View State.

The following code example shows the event handler for the SelectedIndexChanged event of a control named DropDownList1. The handler creates as many label controls as the user has selected from the drop-down list. The container for the controls is a PlaceHolder Web server control named Placeholder1.

Security Note

User input in a Web page can include potentially malicious client script. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, Script Exploits Overview.

private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
    DropDownList DropDownList1 = new DropDownList();
    PlaceHolder PlaceHolder1 = new PlaceHolder();

  // Get the number of labels to create.
 int numlabels = System.Convert.ToInt32(DropDownList1.SelectedItem.Text);
 for (int i=1; i<=numlabels; i++)
 {
   Label myLabel = new Label();

   // Set the label's Text and ID properties.
   myLabel.Text = "Label" + i.ToString();
   myLabel.ID = "Label" + i.ToString();
   PlaceHolder1.Controls.Add(myLabel);
   // Add a spacer in the form of an HTML <br /> element.
   PlaceHolder1.Controls.Add(new LiteralControl("<br />"));
 }
}

Best ASP.NET Hosting Recommendation

ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers ASP.NET hosting starts from $1/month only. They also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable ASP.NET Hosting, ASPHostPortal.com should be your best choice.

 



ASP.NET Hosting - ASPHostPortal.com :: How to prevent Button Click in ASP.NET ( Until Insert Query Done)

clock September 19, 2016 21:22 by author Dan

In this post you will see how to do some simple prevention on Asp.net page button click until long time inserting query done.

If you work a lot with SQL Store procedure, or other ways of T-SQL communication between your Asp.net page and database, it's so possible that you have to do some prevention when user try to insert or update some long data to SQL .

With this line of code when user make first click button become a disabled until inserting,updating done!.

protected void Page_Load(object sender, EventArgs e)
{
        Button1.Attributes.Add("onclick", " this.disabled = true; " + ClientScript.GetPostBackEventReference(Button1, null) + ";");   // C#
}

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Button.Attributes.Add("onclick", " this.disabled = true; " &
ClientScript.GetPostBackEventReference(Button1, Nothing) & ";") // VB.NET
End Sub

Best ASP.NET Hosting Recommendation

ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers ASP.NET hosting starts from $1/month only. They also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable ASP.NET Hosting, ASPHostPortal.com should be your best choice.



ASP.NET Hosting - ASPHostPortal.com :: Easy Steps to uncompress CSS or Indent CSS Tag in ASP.NET

clock September 16, 2016 23:05 by author Dan

To uncompress CSS or to restore line break and tab or format css back to state before it was compress, then use this utility.

1) Create one empty web application.

2) On Default.aspx add following lines of code. Following line of code will create one text box to input css, button to Indent CSS tag

<h2>
Welcome to My CSS Indenting Application
</h2>
<p>
<asp:TextBox ID="txtCSSInput" runat="server" TextMode="MultiLine" Rows="10" Columns="50"></asp:TextBox>
</p>
<p>
<asp:Button ID="btnIndentCSS" runat="server" Text="Click to Indent CSS"
onclick="btnIndentCSS_Click" />
</p>
<p>
<asp:Label ID="lblDisplayCSS" runat="server" Text=""></asp:Label>
</p>


3) Add following line of code in Code behind (Default.aspx.cs)

protected void btnIndentCSS_Click(object sender, EventArgs e)
{
lblDisplayCSS.Text = txtCSSInput.Text
.Replace(".", "<br/>.")
.Replace("}#", "}<br/>#")
.Replace(";", ";<br/>")
.Replace("{", "{<br/>")
.Replace("}", "}<br/><br/>");
}


That's it and you are done!


Best ASP.NET Hosting Recommendation

ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers ASP.NET hosting starts from $1/month only. They also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable ASP.NET Hosting, ASPHostPortal.com should be your best choice.



ASPHostPortal.com Announces nopCommerce 3.80 Hosting Solution

clock September 13, 2016 21:22 by author Dan

Today, ASPHostPortal.com offers reliable nopCommerce 3.80 hosting solutions with fast loading speed, and uptime guarantee. We care for the clients, ensuring each and every client is more than just satisfied day in and day out. We have provided exceptional plans, at the lowest prices, for the best services possible, on fastest nodes ever. Our servers are connected to the network using multiple 1Gbps ports (bond network). So, customers don't have to worry about the speed of their website.

nopCommerce is the best open-source e-commerce shopping cart. nopCommerce is available for free. Today it's the best and most popular ASP.NET ecommerce software. It has been downloaded more than 1.5 million times! nopCommerce is a fully customizable shopping cart. It's stable and highly usable. nopCommerce is an open source ecommerce solution that is ASP.NET (MVC) based with a MS SQL 2008 (or higher) backend database. Some days ago, nopCommerce released their new nopCommerce 3.80 version.

ASPHostPortal.com provides full trust web hosting services for customer's nopCommerce 3.80 site. nopCommerce 3.80 is an open source ecommerce software that contains both a catalog front-end and an administration tool backend. nopCommerce 3.80 is a fully customizable shopping cart. It’s stable and highly usable. From downloads to documentation, nopCommerce.com offers a comprehensive base of information, resources, and support to the nopCommerce community.

Established in 2008, ASPHostPortal.com is one of the leading nopCommerce 3.80 hosting provider offering quality services with premium support. We support this new technology with affordable price, a lot of features, 99.99% uptime guarantee, 24/7 support, and 30 days money back guarantee. We strive to make sure that all customers have the finest web-hosting experience as possible. To learn more about our nopCommerce 3.80 Hosting, please visit http://asphostportal.com/nopCommerce-3-80-Hosting

About ASPHostPortal.com:
ASPHostPortal.com is The Best, Cheap and Recommended ASP.NET & Linux Hosting. ASPHostPortal.com has ability to support the latest Microsoft, ASP.NET, and Linux technology, such as: such as: WebMatrix, Web Deploy, Visual Studio, Latest ASP.NET Version, Latest ASP.NET MVC Version, Silverlight and Visual Studio Light Switch, Latest MySql version, Latest PHPMyAdmin, Support PHP, etc. Their service includes shared hosting, reseller hosting, and Sharepoint hosting, with speciality in ASP.NET, SQL Server, and Linux solutions. Protection, trustworthiness, and performance are at the core of hosting operations to make certain every website and software hosted is so secured and performs at the best possible level.



ASPHostPortal.com Announces Drupal 8.1.8 Hosting Solution

clock September 6, 2016 20:12 by author Dan

ASPHostPortal.com provides affordable and high performance Drupal 8.1.8 hosting to customers around the world. Our company is passionate about hosting and strive to deliver an excellent level of service to each customer. We strongly believe in high quality standards and Hence customers will always find our services better than every other host in this industry. Today, we announce the availability of Drupal 8.1.8 hosting with reliable service.

Drupal 8.1.8 is a content management system offering shorter time to market, empowerment of end users to do customizations that traditionally requires software engineering, sustainability and lower total cost of ownership. It’s built, used, and supported by an active and diverse community of people around the world.

Use Drupal to build everything from personal blogs to enterprise applications. Thousands of add-on modules and designs let people build any site they can imagine. Drupal is open source software maintained and developed by a community of over 1,000,000 users and developers.

ASPHostPortal.com offers Drupal 8.1.8 Hosting with expert team support. We support this new technology with affordable price, a lot of features, 99.99% uptime guarantee, 24/7 support, and 30 days money back guarantee. We strive to make sure that all customers have the finest web-hosting experience as possible. To learn more about our Drupal 8.1.8 Hosting, please visit http://asphostportal.com/Drupal-8-1-8-Hosting

About ASPHostPortal.com
:
ASPHostPortal.com is The Best, Cheap and Recommended ASP.NET & Linux Hosting. ASPHostPortal.com has ability to support the latest Microsoft, ASP.NET, and Linux technology, such as: such as: WebMatrix, Web Deploy, Visual Studio, Latest ASP.NET Version, Latest ASP.NET MVC Version, Silverlight and Visual Studio Light Switch, Latest MySql version, Latest PHPMyAdmin, Support PHP, etc. Their service includes shared hosting, reseller hosting, and Sharepoint hosting, with speciality in ASP.NET, SQL Server, and Linux solutions. Protection, trustworthiness, and performance are at the core of hosting operations to make certain every website and software hosted is so secured and performs at the best possible level.



Cheap ASP.NET 4.5 Hosting

We’re a company that works differently to most. Value is what we output and help our customers achieve, not how much money we put in the bank. It’s not because we are altruistic. It’s based on an even simpler principle. "Do good things, and good things will come to you".

Success for us is something that is continually experienced, not something that is reached. For us it is all about the experience – more than the journey. Life is a continual experience. We see the Internet as being an incredible amplifier to the experience of life for all of us. It can help humanity come together to explode in knowledge exploration and discussion. It is continual enlightenment of new ideas, experiences, and passions


Author Link


 

Corporate Address (Location)

ASPHostPortal
170 W 56th Street, Suite 121
New York, NY 10019
United States

Tag cloud

Sign in