asp.net

How to convert string to int in C#

1. You could call the ToInt32 method to convert an input string to an int:

int numberVar = Convert.ToInt32(“37”);

2.You could also convert a string to an int through the Parse method of the System.Int32 struct:

int numberVar = Int32.Parse(“-37”);

Related TutorialsHow to preserve member variables for an ASP.NET page in C#
How to transfer information between pages in ASP.NET using a query …

Learn more

How to call JavaScript from ASP.NET code behind

To call JavaScript from C# code behind you should:

1. Set the Body tag in your page/master page to runat=”server” and an id=”MyBody”.
2. Code the script tag in your page:

<script src=”MyFunction.js” type=”text/javascript”></script>

3. In the code behind attach the onload attribute to the body tag:

protected void Page_Load(object sender, EventArgs e)
{
MasterPageBodyTag = (HtmlGenericControl)Page.Master.FindControl(“MyBody”);
MasterPageBodyTag.Attributes.Add(“Onload”, “MyFunction()”);
}

Related TutorialsHow to create an ASP.NET web-page client for …

Learn more

How to get IP address in ASP.NET

Whenever a browser sends a request for a page, it also sends a number of other headers to the script, containing information such as the browser type. It also includes information such as the visitors IP address.

In ASP.NET you can get the IP address of your users from the Request.ServerVariables collection. The following ASP.NET code will display the …

Learn more

What is ASP.NET?

ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites, web applications and web services. It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft’s Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime (CLR), …

Learn more