C# - Combine Javascript/CSS Into One File Or Two For Better Optimization?
Jan 24, 2011
I am currently working on an c# application that minimizes and combines javascript/css asynchronously in the background to load on to the page which completed. Once the combined minimized file(s) are created, they are saved on to disk and all subsequent requests to the page will load this file.
The reason for this is to assist with performance on the page. I have a concern though, what if the combined file is large, eg 200 kb. Would it be better to combine in to 2 files if this was the case and have 2 separate http requests? The file will be gzipped and cached.
View 3 Replies
Similar Messages:
Apr 17, 2010
i got a question that realy bothering me .... for the last 24 hours ...
how to combine c# and html/javaScript .....??
so ... the question :
for example i create a varible in my asp.net form .......
int variable = 2;
// some function .....
protect int makeItdouble(int variable)
{
return variable*2;
}
variable = makeItdouble(5); // some code i
and now i want to take this "variable" into my my javascript code .... this important thing is that i want thet this function will run first .... (the C# function)cus i take first my DataBase from the server and that prosses him more with some javascript code ...
View 10 Replies
Feb 2, 2011
I am developing in asp.net mvc and using multiple javascript files.eg jquery, jquery-ui, google-maps my own js files etc.for performance should i combine these into one?if so how?
View 4 Replies
Jan 5, 2011
Is there some way to intercept the HTML output stream in asp.net and make modifications? Eg using httpmodules or something? I know this is possible using java servlets and assume there must be an elegant way to do this with asp.net.
My purpose is to combine the many javascript files into one composite script which has been minified/packed, to make the page load faster.Eg, if my page normally outputs the following in the page head:
<script type="text/javascript" src="/scripts/blah.js"></script>
<script type="text/javascript" src="/scripts/yada.js"></script>
I want to replace that with the following:
<script type="text/javascript" src="/scripts/all.js"></script>
(also i realise i'll have to create all.js somehow).
View 2 Replies
Mar 19, 2010
I'm having a little trouble with an upload of a file. I wanted to add today's date in the name of the file so that when a user uploads a file such as "image1.jpg" it would be saved into the server as "image120100319.jpg" and stored in the database as in a field as /myfolder/subfolder/image120100319.jpgthis script works when I comment the new additions which are
[Code]....
string SQL = "INSERT INTO my table (dailyFile) VALUES(@IMGDAILYFILE)";
cmd.Parameters.Add(new SqlParameter("@IMGDAILYFILE", SqlDbType.NVarChar, 80));
cmd.Parameters["@IMGDAILYFILE"].Value = "/myfolder/subfolder/" + destPath3.Substring(destPath3.LastIndexOf("\") + 1);
View 2 Replies
Jul 17, 2010
I'm tring to write a function that need to save a file (in csv) and has a condition.
it's something like that:
If the file is small then 1MB then I want to pop up an alert in javascript and then continue with the save as file commands.
What I did was:
if(...)
{
}
else
{
ClientScript.RegisterStartupScriptBlock(...alert('aaa')...);
}
Response.ContentType = "text/csv";
Response.AppendHeader("Content-Disposition","attachment; filename=file.csv");
Response.TransmitFile("FILE.csv");
Response.End();
the save as works fine. but the alert wont popup in the else case. I tried RegisterStartupScript. I tried many options. But it seems that the response.end is stops the clientscript from happening.
I am writing in c# asp.net (ajax enabled website, but not in use), visual studio 2005.
View 1 Replies
Oct 21, 2010
I have a DataList containing an ImageButton whose ImageUrl property I want to set by combining it with a string returned from a codebehind file property and a database value.
I have a protected property in my codebehind called strPath.
I want to combine it with a database value in my aspx file. Like so:
[Code]....
View 1 Replies
Jan 27, 2011
I am using ajax control toolkits and ajax extentions in my projects. and as you know it overhead some libraries to page. How can I combine them into 1 js file to reduce requests to server ???
View 2 Replies
Feb 26, 2010
I have a question related to MVC2, VS2010, AJAX Minifier 4.0 and Build.
I hope it is ok to ask here since it is related to my MVC2 project and probably other people in this forum might have done something like this.
Some time ago I found
SmallSharpTools Packer.NET in
Scott Hanselman's Blog:
I have been using it to minify and combine JS and CSS files. Not when building the MVC application but using a Console Application.
Now I found that Microsoft Ajax Minifier 4.0 already minifies CSS files.
The results seem good and it is a Codeplex project ... So I am planning to move from Packer.NET to Ajax Minifier.
To reduce the number of requests I combine JS files (usually the JQuery Plugins used into a single file JQuery.Plugins.min.js).
It seems Ajax Minifier does not combine files ...
I can include a class on the MVC project which minifies the files using Ajax Minifier and combines the ones that needs to be combined.
The question is: how to include this on the build process of the MVC Application ...
And how to delete the original files on the build version? I only need to have the minified versions after the build ...
View 1 Replies
Feb 11, 2010
i have two models that represent two related tables:
class Article
{
Guid ID;
Guid AuthorID;
string Title;[code]...
i need to show this view model in a view:
class ArticleWithAuthor
{
string ArticleTitle;[code]...
in a controller for Article i need to create a view model for the given article id. i read somewhere that a good way to create a view model is to write a mapper that translates from model to view model.
my question is:since the mapper needs a model to work with, it seems that i need two database requests: one to retrieve my Article model and the other one to get my Person data to merge them in the model view. this seems inefficient. is there a way to combine these requests and still follow this "Entity Translation Pattern"? i know of course that i can create my view model "manually" by writing a custom LINQ expression but i am trying to follow the MVC guidelines.
View 5 Replies
Jul 21, 2010
I am working on ASP.NET website. I need to post a Question Paper based on following parameters.
University
Branch
Subject
At Present My URL is in the below mentioned format
//localhost/MYASP/Posted?PostId=**
My URL should be in the below mention format after URL Rewriting
//localhost/MYASP/Posted/University/Branch/Subject/TITLEOFThePost
let me know the process of finding my querystring after url rewriting
View 2 Replies
Feb 3, 2011
I have an application using data from multiple stored procedures in a single database.The dataacess is disconnected one. Entire data is required during loadtime i.e. all calls made at load time. I want to know what is the most optimized way to do it. As the connection is required with only one database,is there a way to create it once and use it for the next times. I am aware of connection pooling but its anyways done by default. kindly suggest some way to optimize the load time. Also the result set from all the procedures cannot be clubbed so multiple stored procedure invoking is compulsory required.
View 1 Replies
Feb 26, 2011
i have awebsite and i made all my steps to make it in the first links on the search of google (SEO) and now i want to go to google updates to make the steps that apply the website on google after one day almost. can any one tell me what i should begin with or do?
View 7 Replies
Jan 7, 2011
I am working on a large project where I have to present efficient way for a user to enter data into a form.
Three of the fields of that form require a value from a subset of a common data source (SQL Table). I used JQuery and JQuery UI to build an autocomplete, which posts to a generic HttpHandler.
Internally the handler uses Linq-to-sql to grab the data required from that specific table. The table has about 10 different columns, and the linq expression uses the SqlMethods.Like() to match the single search term on each of those 10 fields.
The problem is that that table contains some 20K rows. The autocomplete works flawlessly, accept the sheer volume of data introduces deleays, in the vicinity of 6 seconds or so (when debugging on my local machine) before it shows up.
The JqueryUI autocomplete has 0 delay, queries on the 3 key, and the result of the post is made in a Facebook style multi-row selectable options. (I almost had to rewrite the autocomplete plugin...).
So the problem is data vs. speed. Any thoughts on how to speed this up? The only two thoughts I had were to cache the data (How/Where?); or use straight up sql data reader for data access?
View 1 Replies
Dec 6, 2010
I have database with 40 big tables.In each stored procedure query is containing minimum 6 joins.The query is taking too much time to execute.I didn't implemented views and indexes.
View 2 Replies
Aug 17, 2010
I was wondering if anyone had experience they could share using the Response.IsClientConnected property as a performance optimization for asp.net websites.
The reason I ask is that I am a bit skeptical on how effective it would be in real life scenarios. I understand the concept of checking the value before performing a large task but I just can't see how useful this would be as clients could disconnect at any point time.
View 1 Replies
Sep 1, 2010
I have more products in a single aspx page. So I want to upload this page in my remote server where my website is running. How can I test whether search engine can resolve my product on that page?
View 1 Replies
May 30, 2013
I am using VS 2010 login form and aspnet table for user creation and role assignment. Every thing is working excellent.
My concern is that more 200 users will logon on this site simultaneously what will be the effect on performance? how to optimize site speed when more than 200 users will be log on.
View 1 Replies
Feb 25, 2010
I am working on a web application that is consuming a Dataset returned by a web service. As the application is running I store that Dataset as a session variable to be used over and over again as the user navigates to the different pages that will edit the tables within the dataset. The idea was the user will only have to wait for the data once when the application loads then the application would use the session variable until the user saves the changes they made, when that happens it would pass the edited tables to the service to update the database. Is there problems with this design and the storage of the Dataset and Datatables as a session variable?
View 4 Replies
Jan 27, 2011
I have two user controls and both the user controls refer a same script path:
<script type="text/javascript" src="test.js"></script>
then what happens when the first user controls load then test.js will download in client and when second user control loads then test.js file will download again.
How do I check to see if the JavaScript file is already downloaded so it doesn't have to be downloaded again?
If I include the JavaScript file from the server side:
Page.ClientScript.RegisterClientScriptInclude("test",
Page.ClientScript.GetWebResourceUrl(this.GetType(),
"test.js"));
then how could I make sure it isn't included twice?
View 1 Replies
Jun 7, 2010
I am developing a website with huge data which to be stored in SQL Server database. How should I optimize it to make it faster.
1. Using Stored procedures.
2. Functions / Views.
3. Any other methods
View 3 Replies
Nov 4, 2010
I have a report with several filter parameters. Everything works fine presently. For one parameter, I use the LIKE as follows in my WHERE statement:
WHERE drug LIKE '%' + @drugused + '%'
@drugused is the selection value of a dropdown list. But now I want to change my parameter to allow multi-selection. But I am not sure how to write my WHERE statement for this. Normally I would use IN but I'm not sure how to do this with the LIKE.
View 6 Replies
Oct 3, 2010
I'm preparing to pass values to a method:
private string BuildMessage(int templateID, string body, object data)
where the data param is an array of name/value pairs. To prepare my values for that data param I need to combine the properties of a strongly typed class with the values of a simple 2d array.
What's the best way to merge those values?
View 1 Replies
Apr 28, 2010
Is there a utility to combine querystrings? I'm looking for something like:
Input: Combine("test=a&test2=b", "test3=c") Result: "test=a&test2=b&test3=c"
Input: Combine("test=a&test2=b", "") Result: "test=a&test2=b"
Input: Combine("", "test3=c") Result: "test3=c"
And maybe some weird ones:
Input: Combine("&test=a&test2=b", "?test3=c") Result: "test=a&test2=b&test3=c"
View 5 Replies
Mar 1, 2010
Does anybody knows possibilities or approaches to combine ASP.NET with SAP Webdynpro (or to embed/integrate Webdynpro in a ASP.NET (or Silverlight) application) ?
View 2 Replies