Recently I developed a web application which calls many services and loads a lot of data in every page with a lot of calculation in the background from the database, so the site became slower. Then I start searching Google to find out a good solution and got some real good ideas to improve my web application’s performance. Here, in this article, I am shared the tips I applied in the application to improve performance and it really works fine now.
I needed to access every cell of a GridView in Client Side in one of my application, so needed to call javascript from GridView Cell. Actually I have a Dropdownlist , select any of the item from the dropdownlist will change the value of the same row in a different cell and will change the GridView footer row value.




Here is a article showing how to access row and cell of a gridview from client site.
http://weblogs.asp.net/ashrafurrahaman/archive/2009/02/26/javascript-for-gridview-row-level.aspx
Posted in Asp.Net, Javascript | 3 Comments »
I needed to run my web application in a fixed port of my web server due to fixed SiteURL in the web site whcih I needed to change every time from the web config.
Here are simple and easy steps tp run your web application in a fixed port of your web server.

1. Go to Solution Explorer of your project
2. Go to properties of your web site clicking F4 on your web site name.
3. Make “Use Dynamic Port” to “False” and put a “Port Number“, you website will always run in that port number.
Posted in Asp.Net | Leave a Comment »
Send mail is an important and common feature in asp.net. using system.net.mail namespace we can send mail. In that article my main concert is to show how shall we send mail asynchronously, as for a bulk of mail sending asynchronous mail send is very important and asp.net have that feature in it.
I had written a wiki in asp.net on with code on send asynchronous mail.
here you will get codes do send asynchronous mail http://wiki.asp.net/page.aspx/536/send-asynchronous-mail-using-aspnet/
Posted in C#.NET | Tagged ASP.NET | 3 Comments »
I was reading httpwebresponse data and get the basic data from the html data. So i need to remove all html tag, script tags, style tags from page to get original text data. So use a simple regular expression to remove tags. this regular expression was simple like that.
Regex.Replace(mainData,@”<scripts[^>]*>.*?</script>|<s*(?!/?(?:br?|i|p|u)b[^>]*>)[^>]*>”,”", RegexOptions.IgnoreCase | RegexOptions.Singleline) ;
I was working fine but i found that for some pages these are making problem specially problems are coming to remove javascript and styles from html data and data was not coming in a good format.
Finally I have got a very nice tool to do that . name of the tool is Html Agility .
this is a very nice features in html agility , it has libraires to convert html to xml, html to rss and html to text. I used html to text yo convert my httpresponse data to text.
in html agility you will find a class HTMLDocument.cs If you want to convert your webresponses then just add these codes in Load method, bacuase in load method this is reading html file from a local drive so to read webresponse use that code.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader sr = new StreamReader(response.GetResponseStream(), OptionDefaultStreamEncoding);
Posted in C#.NET | Leave a Comment »
Caching is a very important concept in programming . caching is a very nice technique to speed up processing. To increase performance of application caching is a great enhance.
One of my buddy razwan has written a very nice article on asp.net caching using cache dependency on file. You can follow this article to implement that in your applicaiton to speed it up.
here is the link ASP.NET Caching with Cache Dependency on a File
Posted in C#.NET | Leave a Comment »
Sometime we face problen to wrap text. this is a very easy solution to solve wrapping problem .
public string GetFormattedText(string str)
{
string[] parts = str.Split(new char[] { ‘ ‘ });
StringBuilder sb = new StringBuilder();
foreach (string s in parts)
{
sb.Append(Server.HtmlEncode(s));
sb.Append(” <wbr>”);
}
return sb.ToString();
}
In case of firefox its is more easier, just use white-space: -moz-pre-wrap in css style.
Posted in CSS | Tagged Programming | Leave a Comment »
i was reading a book head first design pattern, actually read that book many times, an excellent book. Sharing my details idea singleton design patter.
class diagram of Singleton design pattern

a singleton class is look like that
public class Singleton
{
private static Singleton UniqueInstance; //variable to hold one instance of the class Singleton
private Singleton(){}
public static Singleton getInstance()
{
if(UniqueInstance==null)UniqueInstance=new Singleton();
return UniqueInstance;
}
}
here the Singleton class constructor is private and it has only one static method to get it, that ensures that this class has only one instance, and provide a global point to access it.
Now think for multi threading…
what will happen??? suppose you have 2 threads, so 2 different instance of the object will be created.
WHATS THE SOLUTION ??? Continue Reading »
Posted in General | Tagged design pattern | 3 Comments »
I faced a problem to call 2 methods at the same time from body. and the solution is very simple. I wrote a script block at the end of the page look like that.
<SCRIPT LANGUAGE=”JAVASCRIPT”>
if(document.body.onload)
{
var existingOnLoad = document.body.onload;
document.body.onload = function()
{
existingOnLoad();
MyOwnMethod();
}
}
</SCRIPT>
Posted in Javascript | Tagged Javascript | Leave a Comment »
i was in fun with XAML, sharing some of my rectangular XAML codes with you.
![]() |
<Rectangle x:Name=”rectangle” Stroke=”Gray” StrokeThickness=”1″ Fill=”LightYellow” Width=”50″ Height=”50″ /> |
![]() |
<Rectangle x:Name=”rectangle” Stroke=”Gray” StrokeThickness=”1″ Width=”50″ Height=”50″ > <Rectangle.Fill> <LinearGradientBrush StartPoint=”0,0″> <GradientStop Color=”White” Offset=”0.0″ /> <GradientStop Color=”Gray” Offset=”1.0″ /> </LinearGradientBrush> </Rectangle.Fill> </Rectangle> |
![]() |
<Rectangle x:Name=”start” Stroke=”Gray” RadiusX=”10″ RadiusY=”10″ StrokeThickness=”1″ Width=”50″ Height=”50″> |
![]() |
<Rectangle x:Name=”decision” Canvas.Left=”15″ Height=”40″ Width=”40″ Stroke=”Black” Fill=”LightYellow”> <Rectangle.RenderTransform> <RotateTransform Angle=”45″ /> </Rectangle.RenderTransform> </Rectangle> |
![]() |
<Rectangle Canvas.Left=”10″ Height=”40″ Width=”40″ Stroke=”Black” Fill=”LightYellow”> <Rectangle.RenderTransform> <TransformGroup> <ScaleTransform ScaleX=”1″ ScaleY=”1″/> <SkewTransform AngleX=”-15″ AngleY=”0″/> </TransformGroup> </Rectangle.RenderTransform> </Rectangle> |
Posted in Silverlight | Tagged XAML | Leave a Comment »






