Managing Ever Growing CSS Stylesheets At Server-side

Mar 14, 2011

When developing large application using ASP.NET (MVC or classic, doesn't matter), especially in large team, it is easy to produce a lot of messy, non-traceable CSS definitions. After some time we can end up not knowing why particular definition exists and what is its real effect considering style inheritance and cross-browser differences. Needless to say, changing anything in that mess is a risk and there are hundreds of ways how small change could affect the system.

I know some solutions to organize CSS stylesheets better, like predefined CSS "frameworks" or DotLessCss engine, but I still find it quite hard to cope with CSS as there is no such relationship between HTML markup and CSS styles like i.e. between interface and concrete class in C# code. I know this is by design to make presentation separate from the structure, but I believe it might be useful to have such a correspondence at development level.

Ideally, I need something that can enforce the team not to make messy CSS or be able to clean that mess up automatically. Do you know any resources that may help me, or any guidance how to manage my CSS definitions easily? Let me ask for something a bit different:Despite of my several years of web experience, I believe I would feel much more confident if some of my CSS could be moved into C# code, the same way as some of HTML generation is done by MVC HTML Helpers. It saves me writing a lot of unnecessary markup, still allowing to do so if needed. And it is more unit testable, easier to refactor using tools like ReSharper etc. I don't need mergers and compressors of my CSS, I would like to be able to manage my CSS at declaration level. Maybe there are some tools like that I'm not aware of, or maybe that idea is just wrong and wouldn't be useful?

View 3 Replies


Similar Messages:

SQL Server :: Creating And Managing A Database?

Dec 1, 2010

how I can create a Database in SQL Express, then add tables and columns .. etc to the Database.

On PHP & MySQL I use to go into PhpMyAdmin and do that all there ! However with SQL Server Express and Visual Studio 2010. how to do it.

View 3 Replies

Managing SQL Server Connected To Existing DotNetNuke Website?

Oct 14, 2010

Before my time at the company they paid for a very expensive website written in asp.net and dotnetnuke. Absolutely terrible but there's very little that can be done about that now. They won't give us access to the SQL Server for some bizarre reason but they've given us FTP access.

Is there some way I can install a database manager (like phpMyAdmin) using FTP? I think I've found the username and password but I'm not familiar with asp so it's quite a confusing system.

View 2 Replies

C# - Dynamically Growing Text Fields?

Jan 25, 2011

What's the best way to approach the following situation in asp.net mvc2 (c#):I have a form where a user can add more fields ... for example I ask user the details of personal computing devices that they have. For simplicity sake let's say I ask for the brand and type (dropdown list of Desktop/Laptop/Tablet/Other) and they can provide unlimited devices. I will start with a pair of text boxes:

<label>Type</label>
<select><option>Desktop</option><option>Laptop</option><option>Tablet</option><option>Other</option></select>
<label>Brand</label>
<input type="text" />
<input type="button" value="Add more device" />

And then as user click the "Add more device" button I will display another pair of Brand and Type text boxes ... and so on.My question is how should I use HTML helper for this, how I construct the viewModel, etc.I am from PHP background and I used to use the following in PHP:

<input type="text" name="brand[]" />

which on the back end will give me an array of brands ... not sure if that's doable in asp.net environment. I would appreciate any input.[I added the following lines to make my question clearer]
I think I have not been very clear with my question.Suppose I have the following viewmodel:

public class UserRegisterViewModel
{
public string DeviceBrand { get; set; }

[code]...

View 2 Replies

DataSource Controls :: Managing Users In SQL Server 2008 Management Studio?

Jul 12, 2010

I restored a database from another server, and everything looks good except the users.

I'm managing all this from SQL Server 2008 Management Studio as SA.

The users are present in the [u]databaseName > security > users[/u] section, and they exist in [u]databaseServer > Security > Logins[/u]. However I can't change anything in the [u]databaseName > security > users[/u] section, because when I try and make a change, and then I hit OK to apply, it says "[i]login name must be specified[b][/b][/i]". But the login name field is grayed out and I can't modify it(even though I'm logged into the machine as Administrator and SQL as SA).

Also, in the user mapping section, when I try to map one of the users to a database, it says '[i]create failed user already exists[b][/b][/i]'...but I don't want to create the user, I just want to map that user to the appropriate databases...

View 2 Replies

Web Forms :: Get Dynamically Growing Label Height In Pixels

Aug 5, 2010

The characters that are entered in the text box will be displayed in the label at the button click event. Label is having fixed width for ex,200px but the height is not set for the label. By changing the characters in the text box,and firing the button click event the label will get populated with the text from the text box. At that time label width will be constant but height will change dynamically according to the no of characters entered in the textbox. Here I need to get the label height in pixels on the button click event?

View 8 Replies

Forms Data Controls :: Stop Growing Header In Grid View?

Oct 27, 2010

Grid view header should not grow big on top when less elements are present,if i have more elemnets/rows header appearing as small if i have less rows 2 to 3 rows header growing bigger, i want header should be of fixed size whether it does have less or more records.

View 9 Replies

Server Side - Themes Won't Work When Using Server Side Tags

Apr 8, 2010

The code for the asp.net page is:

<div class="facebox_content">
<% if (CurrentUser.Role == "Free")
{
%>
<table cellpadding="0" cellspacing="0" style="border-collapse:collapse;width:380px;">
<tr>
<td>

User Name :

</td>
<td>

Membership Cost :

</td>
</tr>
<tr>
<td style="width:190px;">
<asp:TextBox ID="txtUserName" Enabled="false" runat="server" Text="<%= CurrentUser.Name %>"/>
</td>
<td style="width:190px;">
<asp:TextBox ID="txtCost" Enabled="false" runat="server" Text="2000"/>
</td>.........

View 1 Replies

Configuration :: Stylesheets And Gif's Not Serverd By Iis

Dec 11, 2010

I have a VS 2008 asp.net application which runs perfectly under the Visual Studio environment. I have deployed the application to my local IIS (IIS 7 on 64 bit Windows 7 on the same PC as my VS 2008). When I then try and connect to the default.aspx page, I get the basic page but no stylesheet or gifs appear to be downloaded. I have run the app using Live HTTP headers and get code OK 200 saying that the resources have been retrieved but they are clearly missing. I have my stylesheets and GIFs in 2 subfolders of the root folder ( ie is rootmyappCSS and rootmyAPPResources ).

I have changed the pathing etc (using ../ and ~/ notattions and still cannot get the stylesheets/GIFs to appear on my default.aspx page). The web logs do not show any errors. Does anyone know anything else I can try? Or point me to the next step in resolving this problem?

View 6 Replies

C# - Adding StyleSheets Programmatically In Asp

May 31, 2010

I want to add StyleSheets programmatically in the head section but one of the examples I saw seemed to need to many lines of code to add just one style sheet even though I may need a lot: Example Code:

HtmlLink css = new HtmlLink();
css.Href = "css/fancyforms.css";
css.Attributes["rel"] = "stylesheet";
css.Attributes["type"] = "text/css";
css.Attributes["media"] = "all";
Page.Header.Controls.Add(css);

I also use Page.Header.RenderControl() method but it didn't work either. Object null something error was thrown. I also used Page.Header.InnerHtml and InnerText += "<link .... "/> things but they threw the Literal error which is I think common error. I used this code :

List<Literal> cssFiles = new List<Literal>();
cssFiles.Add(new Literal() { Text = @"<link href=""" + ResolveUrl("~/Resources/Styles/MainMaster/MainDesign.css") + @""" type=""text/css"" rel=""stylesheet"" />" });
cssFiles.Add(new Literal() { Text = @"<link href=""" + ResolveUrl("~/Resources/Styles/MainMaster/MainLayout.css") + @""" type=""text/css"" rel=""stylesheet"" />" });
AddStyleRange(cssFiles);
private void AddStyleRange(List<Literal> cssFiles)
{
foreach (Literal item in cssFiles)
{
this.Header.Controls.Add(item);
}
}

It worked at first but when I change the pages it stopped working. I am using Master Page and I am writing these codes on Master.cs file and also some people recommended to use this.Header instead of Page.Header but when I built it throws an error which says I cannot declare that like this. It shouldn't be that hard to add many styles.

View 2 Replies

C# - Override Stylesheets Embedded In Telerik Assembly?

Oct 29, 2010

Embedding RadEditor in my page but Master page's CSS is screwing it up ..like Editor's content area is inheriting background-image property of the body tag when I want it to be white..drop down lists inside of Editor too are not displaying correctly..I don't wanna create whole new custom skin

View 1 Replies

Web Forms :: How Do You Write To A Client-side Control (text Box) With Server-side Code

Jan 6, 2010

If I have a standard HTML textbox

[Code]....

but got a readonly error.

View 10 Replies

Access Server Side Variable On Client Side And Vice Versa And JavaScript?

Dec 9, 2010

I have a requirement of adding server side variables in client side and other way round. Because I need to set a value from client side using javascript and access the same in code behind page.

I have to use C#.Net and JavaScript.

View 2 Replies

Jquery - Options For Page With Matching Client-side And Server-side Markup?

Oct 17, 2010

Suppose I'm building a StackOverflow clone using webforms ASP.NET and jQuery. The Question page has a question, several answers, and comments under each. Requirements:Users can post new answers and comments, and edit existing ones, without postbacks. No UpdatePanels; the AJAX calls retrieve just the JSON they need, not HTML fragments. The page loads with all existing answers and comments in place (no javascript needs to run to read the page).

What I'm trying to figure out is how to do this without having to maintain two sets of markup (one that's bound on the client using some form of jQuery templating, and one that's bound on the server using traditional WebForms).

View 7 Replies

Ajax - Listbox Items Client Side Reordering Not Reflected In Server Side?

Jan 5, 2010

I reordered some items in a listbox using Javascript. When I read the items in a postback in the code behind (ASP.NET), the order is in the original order. How do I get the same order as shown in the screen after Javascript manipulation?

View 3 Replies

AJAX :: To Know Error Like Username Or Password Is Incorrect On Client Side Instead Server Side?

Oct 4, 2010

I m using site login Control in my login.ascx file and disaplaying login control in Div so if there is login link in page and i click on that then Login Div will popup which is site login.May i know how can handle error like username or password is incorrect on client side instead server side?

View 6 Replies

Print The Aspx Page Either Using Server Side Or Client Side Approach?

Feb 9, 2011

I have to implement the print functionality on aspx page like on click of print image icon user will be able to get the print out of aspx page .aspx page will contain the server controls like textboxes , Gridview etc which one approach will be the best server side or client side printing ?

View 4 Replies

Web Forms :: Setting Hidden Value Server Side And Accessing On Client Side?

Jul 19, 2010

I am trying to set a hidden type value to x on Server Side and then access it with Javascript. I have tried multiple ways to accomplish this.

At the basic level this is what I am trying to do.

Aspx page
<asp:HiddenField ID="HidRowNumber" runat="server" />
CS Page
In IsPostBack
HidRowNumber.Value = EFileRowNumber.Text;
Javscript
var status = document.getElementById("<%= HidRowNumber.ClientID %>").value;

When I am debugin it say it HidRowNumber's Value has changed to x but when I access the value with JS it always returns ''.

View 23 Replies

Web Forms :: How To Unescape( Escaped HTML) By Server Side Not By Client Side

Aug 7, 2010

i can use escape() and unescape() functions by Client side easily, but the problem when i have use escape() method for peice of HTML , then i dont know how to unescape this piece of HTMl By Server Side not By Client Side. how i can unescape (escapped HTML) by server side?

View 2 Replies

Web Forms :: Retrieve Value If Server Side Control Value Is Updated On Client Side

Oct 26, 2010

I have a hidden variable and its value is being updated using javascript(client side) which I make a call from server side code. After making the call I am not able to retrieve the updated value from Server side variable. I went through this forum [URL] but not able find a way how to implement functionality with IFRAME. I am trying to call the client side code and retrieve the updated value from server side in page_load event.

View 5 Replies

VS 2005 AJax Tab Container - Enable The Server Side Not Client Side

Feb 4, 2010

I have set the ajax tabs disable on form load. ON button click, I want to enable the tab server side,not client side.

protected void btnEnableCostPetroleumTab_Click(object sender, EventArgs e)
{
TabContainer2.Tabs[0].Enabled = true;
}

But its not enabling the tab?

View 12 Replies

Server Side Control Hidden - Possible To Read Values Client Side

Jan 30, 2010

I've got two textboxes running server side and have their visibility turned off. I'm using a couple of ASP.NET controls which require the textboxes to exist. However, I am filling them from the code behind and would not like the user to see this. Can the user turn the visibility on and see the values entered in the text box? I tried using FireBug, and I couldn't seem to select the visibility option in order to edit it. However, I'm quite new to Firebug, so there may be another way? Or does running it server side mean that the client can't ever view the contents of the textbox?

View 1 Replies

JavaScript - Exposing Server-side State Through Client-side Controls

Feb 11, 2011

I have a list of items on an ASP.net page. That list is selectable in that whenever the user clicks on one, the page does a postback and the server code stores the index or some unique identifier of the picture in a ViewState property indicating that it is currently selected.

I would like to minimize the load on the server and therefore I would like to store the index or unique identifier representing the image in some way on the client side. The best way I can think to do this is to store said information in a hidden field ), however I had two questions about this before I go crazy:

Is this a security risk in any way, shape or form (i.e., exposing implementation details of the page)?
Is there a better/best way to do this that is more industry-standard? Does ASP.net provide a framework to do this that is cleaner than my idea? Seems like this would be a fairly common requirement to me...

View 1 Replies

First Invoke Server Side Code Then Client Side Script Without Using AJAX?

May 18, 2010

in a form i have a buttoin, when click both OnclientClick and postback should happen. on clicking the "Email" button a client side "mailto" tag should do the work and pull a new message window on the client's machine.

whereas, the email addresses should be invoked by the post back. so , when clicking the button the server side post should happen and on return the client side script should be invokded with the values read during post back, and populate all the email addresses.

i need know how to first do a server hit take the values and then execute the client script with those values without using AJAX

View 1 Replies

How To Write To A Client-side Control (text Box) With Server-side Code

Jan 6, 2010

If I have a standard HTML textbox: I can retrieve the value using Request.Form. But how do I go about populating this textbox from the server-side? I tried Request.Form["txtTest"] = "blah"; but got a readonly error.

View 2 Replies







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