Cybercrux

Everything is achievable through technology

ASP.NET

ASP.NET is a development framework for building web pages and web sites with HTML, CSS, JavaScript and server scripting.

ASP.NET supports three different development models:
Web Pages, MVC (Model View Controller), and Web Forms.

 

How to get Form sender name in PageLoad
1. Request.Params[“__EVENTTARGET”].ToString();
2. Button clickedButton = (Button)sender; if(clickedButton.Text == “bla”)

javascript alert in success of form, best method

Page.ClientScript.RegisterStartupScript(this.GetType(), “success”, “alert(‘Submitted Successfully’);window.location.href=’” + Request.RawUrl + “‘”, true);

html tag remover in asp.net

using System.Text.RegularExpressions;

const string HTML_PATTERN = “”;
static string StripHTML (string inputString)
{
return Regex.Replace
(inputString, HTML_PATTERN , ” “);
}

Increase cache of a page by adding the following code

protected void Page_Load(object sender, EventArgs e)
{
Response.Cache.SetExpires(DateTime.Now.AddMonths(1));
Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate);
Response.Cache.SetValidUntilExpires(true);
}

Leave a comment