Developers Archive for the 'asp development' Category

HTML enhancements in ASP.Net 2.0

HTML enhancements in ASP.Net 2.0 Tuesday, March 11th, 2008

HTML enhancements in ASP.Net 2.0

Accessing tag:

The link tag is useful to register a CSS file with our Webpage. It can be accessed in codebehind or can be added through codebehind by the following code.

HtmlLink cssLink = new HtmlLink();
cssLink.Href = “StyleSheet.css”;
cssLink.Attributes.Add(”rel”, “stylesheet”);
cssLink.Attributes.Add(”type”, “text/css”);
Page.Header.Controls.Add(cssLink);

This will inject a

This class is new in 2.0 while this also can be achieved thro HtmlInputButton class in 1.x.

Overview of Delegates(C#)

Overview of Delegates(C#) Monday, March 10th, 2008

Definetion:Delegate is nothing but the pointing the function.

How to call method using Delegate:

delegate void getvalue(); //Above class you have to declare delegate
public partial class Global : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
getvalue test=new getvalue(testpgmr);
test();
}
protected void testpgmr()
{
Response.Write(”pgmr”);
}

Output

pgmr

How to clear all the textboxes in my form

How to clear all the textboxes in my form Monday, March 10th, 2008

foreach (Control ctl in Page.Controls[1].Controls )
{
TextBox tb = ctl as TextBox;
if (tb!=null)
{
tb.Text = “” ;
}
}


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.