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


Similar Messages:

AJAX :: How Event That Occurs Every One Second Affect The Web Page Performance

Jun 23, 2010

I am using the timer inside UpdatePanel to check the time every second and enter it to a label control.

But I must ask, How this is going to effect performance? Bandwidth of the site?

View 6 Replies

Web Forms :: To Place A Sub In The Code Behind Of My Master Page

Aug 9, 2010

I wish to place a sub in the code behind of my master page, that will be used to assign variables used in the content pages based on query string values. I would like to see advice on general syntax as it relates to the relationship between master pages and their content pages.I would much rather pursue this route as opposed to repeating the same code on every content page.

View 1 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

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

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

How To Avoid Storing Different Type Of Objects In The Same Place When Represent The Same But With A Different Data Structure

Jan 14, 2010

This is in my opinion an abstract problem and I hope I can explain it well. I happened to find the same kind of problem in a completely different project and now I have it again and I would like to avoid it if possible.

I'm creating some classes to simplify some tasks for some specific requirements we have in some projects at work.

I have a class that creates objects which maps the values from webcontrols to an object properties similar to this

[URL]

The problem I have it's sometimes I have to store a non container object in a place (in an object's attribute) and sometimes I have to a store a container object in the same place for storing the values of a webcontrol (a webcontrol can sometimes hold several values like a checkboxlist). I dont like this at all, because some time ago when working in a non commercial compiler, when parsing and generating the intermediate code I had sometimes to store a container in a place, and sometimes I had to store a non container in the same place, and having to ask in other parts of the code if what you are reading is this type of object, or this another type of object, it is something really annoying and it mess up the code. Is there any tips about what it would be better to do to avoid this kind of situations or nothing can be done to avoid it sometimes?

View 3 Replies

Repeater Itemdatabound Event Value Type And Reference Type?

Mar 29, 2010

Im trying to bind a list with datetime objects to my repeater.

if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
{
DateTime actualDate = e.Item.DataItem as DateTime;
}

When I want access the itemdatabound event on the repeater Then I get an errormessage which says that DateTime is a valuetype and not a reference type.My solution is that a wrap the datetime in a custom object (reference type) and pass that to the repeater datasource instead of the datetime. But Im wondering if there are other solutions where the repeater takes valuetypes (DateTime objects).

View 1 Replies

Where To Place Code For Session Objects In App

Aug 21, 2010

I am getting a serialization error trying to use Session State Server instead of InProd. However, I can't figure out what is causing the error in session. I was given some code to add to the page to loop through the session object and figure out if each item in it is serializable. My problem is I don't know where to place the code in the ASP.NET page. In tracing through the code, the error just appears after steping through objects outside of the page and not when setting session. There must be some place that I can place the code on the page that is after all session objects are set but before the page will error. Where would that be?

View 2 Replies

C# - Can Place Code From Webform Into Class

Dec 11, 2010

I have some code in a button_click event in my webform that performs some actions
(writing some xml files).But i wish to place all my XML code in 1 class within my webproject.But how do i exactly acces controls from my webform on this class?nd how do i link those 2 with each other?Ive tried inherit from System.Web.UI.Page in my class but seems thats not quite it.

View 1 Replies

AJAX :: How To Place UpdateProgress In Code

Jul 8, 2010

I have three grids in a table. These three grids have three refresh buttons Ref1, Ref2, Ref3 attached to each other respectfully.

Now i want to click the first Ref1, then my first grid will be refrehed and the <iFrame> opaqueness whould be covering the first grid only.

View 13 Replies

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

Postback Code In Page Load Event?

Aug 6, 2010

I have alot of code in the page load event as below.

Is it best practice to use (!NotPostBack) and wrap the code in this block or does it depend on the methods etc. I also have code which populates ajax slideshow as well which gets images from database.

[code]....

View 4 Replies

How To Place A Code Inside HTML Webpage

Nov 23, 2010

Is it possible to place .net code inside of a .html webpage?

View 3 Replies

Where To Place Google Analytics Code In Web Application

Oct 19, 2010

I want to find a place to put my Google Analytics code in my ASP.NET web application. I would like to place it somewhere once and not have to copy and paste the code into multiple files. Is there somewhere that I could inject it that I would only have to include it once and all pages would be effected? I am not using MasterPages unfortunately.

View 6 Replies

Web Forms :: View The Page Event With C# Code Behind In Vs 2005?

Feb 9, 2010

In vb.net code behind we can go the code view and from right dropdown box we can view the page events. But i c# code behind i can find events for controls like button and other controls. but in c# how to view the page events.

View 3 Replies

Visual Studio :: Insert Event In Code Behind Page?

Apr 20, 2010

I haven't done much C# programming in a year - now I can't remember how to insert button click event code into the code behind page for an asp.net button in the html side. I know there's a slick way to do it, bit I can't find it anywhere. I remember that it automatically created the event code from the, for example, Button1 element. The event would then be Button1_Click(...).

View 3 Replies

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

Place DataBinding Inline Code Inside Of Inline C# Code?

Jul 28, 2010

How can I achieve the desired effect?

Here's the code:

<% if(!String.IsNullOrEmpty(%><%#Eval(Container.DataItem,"OrderXml");%><%)){ %>

etc., which is placed inside of an ItemTemplate inside of a TemplateColumn. In the CodeBehind page I will bind a value to the OrderXml field, which occasionally is NULL.

Unfortunately I get compilation errors.

View 1 Replies

AJAX :: Display Modalpopup From Code Behind In Page Load Event?

Feb 26, 2010

I am trying to display Modalpopup from code behind in page load event.

View 7 Replies

Web Forms :: How To Place Code In Javascript And Make It Unreadable For The User

Mar 17, 2011

For performance reasons, I would like to put some code in javascript but am concerned that a user may pick up some proprietary formulas. Is it even possible to hide it or scramble it to the user?

View 2 Replies

Configuration :: How To Remove Assembly Files And Place Code File

Jul 13, 2010

I am new to programming and i have one project in which i want to replace the DLL files and want to place the actual code. I have all the code files. how to this?

View 4 Replies

Configuration :: Web.config Trust Level To Medium - Place Code?

Dec 29, 2010

My hosting provider just changed the trust level to medium but I cant figureout where to place the configuration on the web.config file! I have spent hours trying to figureout with no luck. here my web.config file

[Code]....

View 2 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 :: Fire Code - Behind Of Mouse_click - Event With Reloading Master.page?

Jan 17, 2010

for some very special reason i want to click on a button in masterpage.aspx firing the event of code-behind without having reloaded masterpage.master.cs (starting page_load()).

View 3 Replies







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