Posts

Showing posts from January, 2011

Pre-Loader in Asp.Net with javascript

Preloaders give the viewer something to look at while the Javascript, Css file downloads. Whenever we used javascript files and those file in depended each other or write code on HTML markup of javascript which called the function in those files sometime gives an error or sometime give some ugly shape of loading webpage. In this article I focused to create Pre-loader step by step. Demo shows in asp.Net, in this demo we create two aspx pages, first page I use as a pre-loader and second page actual page we want to open. click here to download demo Create a website and then add new aspx page with name of PreLoader.aspx, below code past in markup of it.         var  iLoopCounter = 1;          var  iMaxLoop = 6;          var  iIntervalId;            function  BeginPageLoad() {  ...

C# 4.0 Dynamics vs. Reflection

Image
Hi! Ah ha, today I already wrote two more blog now I am moving on third one, I found new feature in C# 4.0 is Dynamics its to cool. its much faster than reflection mechanism also cached objects, Simply I show demo given below, First I create a Console Application then create a class name is myTestingClass Snippet public class myTestingClass { public string myProperty { get ; set ; } } Now I am going to call the above class by reflection and Dynamics. Snippet static void Main( string [] args) { Stopwatch mystopWatch = new Stopwatch (); long rang = 1000000; var myTestType = new myTestingClass (); var property = typeof ( myTestingClass ).GetProperty( "myProperty" ); mystopWatch.Start(); for ( int i = 0; i { property.SetValue(myTestType, "...

Send email to gmail account in ASP.Net

Image
Hi guys, I am very excited to share with you how to send email to gmail account in ASP.Net, I will try to explain all attribute,Methods and setting in details. First of all we are going to configure gmail account setting in webconfig file, Attribute deliveryMethod : Specifies the delivery method for e-mails. from: Specifies the from address for e-mails configsource: I will explain in last paragraph of this article. port: specifies the port of the server. deliveryMethod : specifiedPickupDirectory: Configures the local directory for a Simple Mail Transport Protocol (SMTP) server. network: Configures the network options for an external SMTP server. we must set Port "587" in webconfig and also set User Id and password of gmail account which you want to send email, Host name should be "smtp.gmail.com". Second step you need to write code of server side in any events. Snippet you also need to declared System.Net.Mail namespace by usi...

RegisterClientScriptBlock Vs RegisterStartupScript

Image
Hi Guys! Since few month ago I very confused about RegisterClientScriptBlock and RegisterStartupScript, Where i used them and what is the difference between. These thing cleared while I was reading a book of Appress for my exams. Anyways, both Method exists in ScripManager Class in .Net Framework Ajax Extensions Library, and both have same signature and same functionality to register client script into web browser but slightly difference between these functionality. I will try to explain difference. RegisterClientScriptBlock: RegisterClientScriptBlock Generate script just after start Forms tag, Sever conrols and other HTML controls render after it(excepted viewstate). Above code result shown below screenshot RegisterStartupScript: RegisterStartupScript generate JavaScript block after rendering all controls and just before End of Forms tag. Above code result shown below screenshot Summary, Whenever we called RegisterClientScriptBlock or RegisterStartupScript both registered JavaScr...