Performance Code-Behind Vs. Class File?

Apr 2, 2010

I was wondering which of these two is better from the aspect of performance.

I was thinking that possibly Class files stored in App_Code works faster because they are sort of pre-compiled but i am not 100% sure.

Specifically i am overriding onInit event on each page using some functions that i am not certain where to place.

Not that i complaint on the speed but i want to be sure that i am doing the right thing.

View 7 Replies


Similar Messages:

Performance Difference In Having Huge Javascript Code Against .js File

Dec 9, 2010

We have a .aspx file which has about 400 lines of javascript code. Is it a good idea to have such huge code in its own file? What is the performance difference in having huge javascript code in aspx as against the .js file?

View 5 Replies

C# - Moving Code From Codebehind To Class File?

Jul 17, 2010

For some time now I am trying to figure out how I can refactor some of my code to reduce redundancy throughout my application. I am just learning the basics of OOP and can create simple classes and methods but my knowledge is limited in terms of practical applicability. The following bit of code illustrates my frustration:

[Code]....

This bit of code is used on several pages of my project in the pages codebehind file. How can I move this to a class file. I don't know how to reference an object like a gridview in a class because it does not exist like it does on the actual page.

View 2 Replies

Web Forms :: How To Write A Code In Class File

Aug 2, 2013

I have a code which saves the control id and its text in database..(and it is working fine).This code is written in default.aspx.cs which will save all the controls(of deault.aspx) id and name in database.I want to make a class file and then call this class file in page rather than writing the code in page because there will be multiple pages where this can be called.write this function DisplyDetails() in class file..code is as below..

public partial class _Default : System.Web.UI.Page
{
string controlId, propertyValue,other;
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["abc"].ConnectionString);
protected void Page_Load(object sender, EventArgs e)

[code]...

View 1 Replies

C# - List <Class> New Class Takes Up Memory - Can Set C=null; In The Code

Jul 23, 2010

List New Class takes up memory?Do I need C=null; in the code below?

//class Category
public List<Category> SelectAll()
{
List<Category> LV = new List<Category>();
string command = "SELECT * from categories";
SqlCommand sc = new SqlCommand(command, new SqlConnection(GlobalFunction.Function.GetConnectionString()));
sc.Connection.Open();
SqlDataReader dr = sc.ExecuteReader();
using(dr)
{
[code]...

View 5 Replies

Code Reusability / Put The Code In One Class And Want To Inherit Same Code In Each Page?

Apr 12, 2010

Following is the code to insert userName from session and PageName into table to keep record that how many times a user does hit a particular page.

To avoid repitition of code I want to put the code in one class and want to inherit same code in each page.

How to get this task? Please do share with me? Here is the OK code:

[Code]....

View 17 Replies

How To Access Label In Parent Class Of Code Behind Class

May 24, 2010

I have a class (name PageBase) that is inhariting System .Web.UI .Page and all my .aspx page behind classes are inhariting this class. This way I have put some common things in PageBase class.

For showing errors I want to put showMessage funtion in PageBase as well so that I may have not put it in every page and it will easy to manage this way.

Probem is that how PageBase class will access a control which is in aspx page in its child class (child class of PageBase) .

I dont want to pass control as argument to function in parent class, is ther any other way ?

View 7 Replies

Performance - Which Page Event Is The Best Place For This Type Of Code

Jan 8, 2010

I have a relatively simple page that will do most of its operations on the client side using Javascript or JQuery. However, initially I do need to retrieve some data from the DB server based on QueryString parameters.

I plan on passing this data in the form of a JSON string to the script by an old-fashioned ASP manner ( var severData = <%=MyPublicData %>) block where MyPublicData is defined in CodeBehind as:

Public string MyPublicData;

The question is, which event in the ASP.NET page lifecycle is the best for this? Page_Init ? Page_Load? Also, is it worth the effort to do this in ASP.NET MVC. I did look at this possiblity but it seemed a little too much for a simple page like this where I do more 90% of the work on the client.

View 4 Replies

Web Forms :: Finding Tool To Check Application And Code Performance

May 19, 2010

Can any one give me the tool link to check the asp.net application and code performance?

View 1 Replies

Web Forms :: Converting .cs Class File To .vb Class File?

Jan 16, 2010

i have code in .cs class file

i need it in .vb

i used conversion tool for converting

but i feel its not proper as i am not able to reference it in my page

is there any other way

View 4 Replies

Web Forms :: Why Class Of User Control Is Unavailable In Another Class File

Nov 18, 2010

I have build a UserControl with separate code behind file.In that code behind file i have defined some public properties in the Partial class of user control that was automatically generated.Those properties will initialize some properties of controls that are used in the control.Now, in .aspx page i used this User Control and initialized the public properties through code behind of aspx page for dynamic contents.

View 6 Replies

Will Commenting-out Unused Code Give Page A Performance Boost In Any Way, Shape, Or Form

Aug 2, 2010

Okay so my situation at work is that I've written about 200 or so lines of additional functionality into an aspx page's code-behind that is currently not to be implemented. It is in a subroutine that handles an event that currently has zero chance of occurring.

Because this code is not being used, I've gotten curious. Should I comment out the subroutine that has zero chance of firing? Would it do anything to enhance the performance of the page or anything like that if I did indeed comment it out? Or could/should I just leave it as is?

View 4 Replies

Performance Difference Of Code In Aspx And Cs Files For Showing And Hiding Control Dynamically

Feb 18, 2011

I was thinking about the performance when I use code to hide some control in aspx page using delimiters or in cs file. For e.g. If I have a panel and I want it to get shown following some condition, so I can achieve this by two ways

1: Using code in aspx file, something like this

<% if(isAllowed) { %>
<asp:Panel ...></asp:Panel>
<% } %>

2: In the code file, something like this

<asp:Panel ID="pnlMyPanel" Visible="false"></asp:Panel>

And in cs file

if(isAllowed)
pnlMyPanel.Visible=true;

In my view, first way should be good as it will not at all create any Panel in the page. Am I correct here?

View 3 Replies

Configuration :: .Net Website Performance Of 2 Sites - Rectify The DB Performance While Insertion?

Sep 20, 2010

I have developed a website in asp.net framework 2 . This website is being hosted in two different servers without any change in code. My issue is about the performance of these 2 sites. One website is taking much time for inserting datas to the DB (SQL server 2005). 2 websites are having different DB server.

I think the issue is for the DB server. How can we rectify the DB performance while insertion and Is there any other cause for this permance issue?

View 1 Replies

How Big Can An XML File Be Before Performance Will Suffer When Powering An ASP.Net Application

Oct 9, 2010

I have an ASP.Net application that has some data driven elements powered by XML with some very basic XPath queries. How big can an XML file become e.g. 10MB, 50MB before the application should start to see a dip in performance when reading from the file.

View 2 Replies

C# - Page Content In Database Vs File Performance?

Sep 29, 2010

I am creating a site whose content is dynamic and has images in it.How much performance hit will my DB (MSSQL) take if I save content/Images in DB?

View 3 Replies

DataSource Controls :: LINQ Performance Application Performance Is Not Up To Par?

Apr 29, 2010

I am not sure if this is the right forum. I can not find a forum for LINQ.

I am working on an application using LINQ. Application performance is not up to par and my tests show that it is LINQ queries that are slow. I was wondering if anybody can recommend where I can find an article about optimizing LINQ performance maybe by compilation or other methods.

View 1 Replies

Does Putting Multiple Classes In One File Impact Performance

Feb 17, 2011

Does putting multiple classes in one file impact performance? Has anyone had any experience with this.

I've read various discussions around application structure and logic of where code can be found with regard to design best practice but little has been said as whether there is any negative/positive/neutral impact on performance.

View 4 Replies

Public Static Variable Declared In Public Static Class MyGlobals In A 'Code File' Template?

Jan 27, 2011

I have a question about C Sharp ASP.NET:Is there a difference (in code speed, resources) between:public static variable declared in public static class MyGlobals in a 'Code File' template;and the variable declared in a normal 'Class File' template;I use this variable in 2 different Class Files and also in _Default Page codebehind cs file.In fact in my case I need about 20 global variables of type List<string>.

View 9 Replies

SQL Server :: Reading File Csv And Inserting Into SqlCE Performance Improvement?

Dec 15, 2010

NOTE: Code and names simplified for post. Elimination of try catch and other best practices also limited for post.

I have a simple SqlCE database one table consisting of 4 columns (specialvalue, name, state)

I am using a streamreader from a file.txt that contains 3000 lines of csv data, looping the below.

s[] = {id,name,specialvalue,state) //(SAMPLE DATA-displaying names)
while(!sr.EndOfStream)
{

[Code]....

This code works as expected but I would like to increase the performance since it takes over 30 sec to complete. I will be moving to a stored procedure later but would like to find out how to optimize the current code. This is more for experience than anything. It is a project that I am working on for codeplex.

View 2 Replies

WCF / ASMX :: Wcf Performance Vs Page Events Performance?

Mar 20, 2011

I am creating a service oriented application where trying to have everything using services....however there is something I am not sure of , I am having a page that calls the database at the page load...so what would be better and faster?? to call database in pageload , or to call wcf service from javascript during javascript load ??btw , I am using a repeater in the page , but I have created somekind of an engine to create the suitable html so...I'll be creating the repeaters html using the wcf and resend it back to the page If I am using a wcf service at the start.

View 1 Replies

Architecture :: Read And Analyze A Very Large Log File With High Efficiency And Performance?

Sep 13, 2010

It is a very large .txt file (more than 3M), and produced everyday, the content is user's system log like below:

2007-11-01 18:20:42,983 [4520] INFO GetXXX() SERVICE START
2007-11-01 18:21:42,983 [4520] WARING USER ACCESS DENIED
2007-11-01 18:22:42,983 [4520] ERROR INPUT PARAMETER IS NULL CAN NOT CONVERT TO INT32
2007-11-01 18:23:59,968 [4520] INFO USER LOGOUT

View 14 Replies

Web Forms :: How To Link .cs(class File) With .aspx.cs File

Oct 6, 2010

i have created basic .aspx files .one is login.aspx and registration.aspx...Now in my solution explorer i also added class file i.e StudentInfo.cs and wrote some properties in it...now my question is

1. i want to connect Studentinfo.cs class to my login.aspx.cs...So that i can call the methods in Studentinfo.cs..how to do it?

View 2 Replies

Performance Of Page With Code And Design In The Same Page?

Jan 8, 2010

I have a query that hit my mind when I was adding an asp.net web page in a project. Normally we place the server side code in the codebehind file. Could there be any improvement in the server side processing if we place both the code and the page design markup in the same page? I am referring to the practice like this:

[code]....

If we use separate codebehind file, we would do all these in the page load event and make div elements visible, invisible according to the test. We could even have only one div in the design page and set its inner text accordingly.

View 2 Replies

Getting Class Code To Work?

May 5, 2010

I am inexperienced using classes so I'm sure I'm not doing things in a standard way. I have created a hierarchy: Deals,Deal, DealSlots, DealSlot that is represented by 4 corresponding vb files So I can reference like so in my aspx pages dim alldeals as class Deals some id=Deals.Deal(1).DealSlots(2).PersonID I created a Public Method GetDealData which is in Deals.vb and gets data from a database and attempts to populate the class variables.I have a test.aspx that uses this function like so:

[Code]....

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved