Jump to content

Help with Masterpage


Recommended Posts

Hi all,


We have an existing site consisting of 14 pages with the same general layout (header, nav bar, footer). The site was created in Visual Studio using asp.net/vb.net and consists of aspx pages. Obviously any change to the header/nav bar and footer is annoying in that all 14 pages and any future pages need to be changed individually.

We are trying to use the Masterpage route to remedy this. I created a master page with the basic layout and took one aspx page and made the changes to include the masterpage and placing the aspx page unique content between the <asp:content> tags. While most of the page looks fine, the formatting that we had for the that particular page's table is ignored. In the original aspx page, we had a style tag with the table's formatting.


The exisitng code is shown below. Notice the table is named dependents and it should point to the style (as it does in the regular aspx page).


One thing to mention is, when I execute the page and display the source, the table is changed to ct100_contentplaceholder1_dependents. To me that means the id is being pointed at the masterpage instead of the aspx page.


Since this table is unique to this page, I do not want to put the definitaion into the master page or a seperate css file.


How do I get the reference to stay with the aspx page?

Thank you in advance.



<asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server" > <style> #dependents { font-family:"Trebuchet MS", Arial, Helvetica, sans-serif; width:100%; border-collapse:collapse; } #dependents td, #dependents th { font-size:1em; border:1px solid #98bf21; padding: 3px 7px 2px 7px; } #dependents th { font-size:1.1em; text-align:left; padding-top: 5px; padding-bottom:4px; background-color:#A7C942; color:#ffffff; } #dependents tr.alt td { color:#000000; background-color:#EAF2D3; } </style> <div class="mainContent" > <section> <table id="dependents" runat="server" > <tr> <th>Dependent</th> <th>Relation</th> <th>Date of Birth</th> </tr> </table> </section> </div> </asp:Content>

Link to comment
Share on other sites

That's kind of annoying that it changes the table ID. One solution may be to change the CSS rules to target the ID ct100_contentplaceholder1_dependents, or use a class instead of an ID (I doubt it would change the class), or it might be possible to tell it to not replace IDs.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...