Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

runat="Server" and how they can be found

Status
Not open for further replies.

lagc

Programmer
Jan 21, 2009
79
GB
I have just taken on a new system by a client that needs re-skining, just about all I can with asp.net systems, as I'm not familiar at all in honesty.

I was going through the code looking for background colours to change and adding a few div's here and there, pretty much working on the CSS file.

I was finding most of the code and css through 'view source', and when I looked for certain pieces of code in the files they didnt exist although they had attrivutes that I need to change, as in the background olur etc.

I then come across these runat="Server" and googled it and fine its an asp.net thing, but I need to change their attrivutes, and this is my question. Where do I get access to the attributes so I can change them, or is that the stupidest asp.net question thats ever been on this forum.

Cheers
 
I'm not sure what attributes you are referring to. If you need to change say a CSS attribute that is in the .aspx page, then you need to have all the source code available to you. Also note, that CSS can be changed and added through code.

You need ALL:
.aspx files
.aspx.vb or .aspx.cs files
.css files
 
Hi,

I'm working out what I need to change by right clicking and viewing the source file. In that source file is a line of code as below:

Code:
<tr id="ctl00_slider" bgcolor="000000">

I then have tried and tried to track down that one piece of bgcolor code, using dreamwevers find and replace function and I can find it in any of the files. The files you mention above I am able to open and look into but still cant find it.

Thats when I found these runat="Server" malarkies, and thought they must be pulling code in from the database somewhere, and thats why I asked how do I get to find them.

I know this would be a silly question to ask? I'm going red already.

Cheers anyway
 
it's not stupid if you don't understand webforms (people use asp.net and webforms interchangably, but they are not) asp.net is the framework for handling http rquests. webforms is an html engine which runs on top of asp.net.

the runat="server" tag tells webforms that it is a server control and thus needs to muck with viewstate, postback, etc. never heard of these terms? they are specific to webforms and if you are versed with php, ruby or the like you will find this convoluted and messy. if all your doing is skinning than this *should* not be an issue.

now for styling. if your are fortunate enough the person before you used either css, themes, or a combination of the two to style the website. from there they may have used inline styling. worst case scenario. they have styling information crammed into the "code behind" file. where are the server code for the form lives. example
foo.aspx
foo.aspx.designer.vb/cs (don't mess with this file, it's autogenerated)
foo.aspx.vb/cs (styling could be located here, that would really suck)

styling works like this with webforms. you have a server control TextBox, CheckBox, GridView, DropDownList, etc.
a majority of the styling elements match 1:1 between properties on the control and the generated html.
setting Width, Color, BackgroundColor, etc. will set the appropriate attributes on the DOM elements.

You will probally find the biggest skinning mess resides with GridViews and Menu server controls. They are not impossible to style, but they are not intuitive about it at all. in some cases it may be better to simply wrap the control in a div with css and use css hierarchies to style the control.

you will also find that styling server controls by ID is near impossible due to the auto-generated naming convention used be webforms. as server controls are nested within one another (MasterPage, GridView, UserControls) the DOM elements ID becomes a mess. yes there is significance, but it sucks from a client coding perspective.

HTH and good luck.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Thank you very much jmeckley, that was awsome...

I'm not going mad then. I will look for those files, if not as you say I will wrap divs around them.

Thanks again, that was perfect.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top