I have a method in c# code behind..which needs to be executed 10000+ lines from Assemblies as well as in Child group Methods. My Question is How to optimize it? It is taking more than 40 Seconds Load to 500 Rows in my page my own gridview which is designed by myself.
Profile your code. That will help you identify where its slow. From reading your post , optimizing might take you a long time since you have alot of code and data.
Virtualize as much as you can. Instead of loading 500 rows, can you try loading 50 rows first, show your UI then load the remainder 450 rows asynchronously ? This doesnt speed up your application, but at least it seems working much quicker than waiting 40 seconds.
This method is very simple, but it can pinpoint the activities that would profit the most by optimizing.
Here are a few options and apply the one that best suits you:
Instantly Increase ASP.NET Scalability
Best Practice No 4:- Improve bandwidth performance of ASP.NET sites using IIS compression
ASP.NET HTTP Compression Overview
20 Tips to Improve ASP.net Application Performance
Evaluate the performance changes with tools measurement:
Page Speed