.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Multiple websites- same code behind but different html and css- making templates

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :ASP.Net

I have atleast 10 websites that have different css,html,javasacripts and webconfig. But the same code behind files.With this design everything is hard to maintain. So I decided to work on it and I started moving all the queries in the code beghind file to stored procedures. Since every website uses the same database.

What I have decided is to make use of themes and multiple master pages? IS this the best way to go about it?

Also lets say I have two templates. There is site A and site B. both using different templates. And have pages Home About Us and Contact.


Now would I be creating three different masterpages? for each template so 6 in total? ( since none of the templates are supposed to look the same)

or Should I just create two masterpages? if so how would I manage the html of the page so it looks different? Thank you

View Complete Post

More Related Resource Links

Multiple websites- usings same code but different markup.


I have atleast 10 websites that have different css,html,javasacripts and webconfig. But the same code behind files.

With this design everything is hard to maintain. So I decided to work on it and I started moving all the queries in the code beghind file to stored procedures. Since every website uses the same database.

Now I am stuck, I dont know where to go from here. Should I create a dedicated server and throw everything in a global access cache? or should I create a dll for every code behind file?

Going in the future this would be used as a profile based system. Where a client, would just go and choose a template and it will work. How would I go about desiging this ? I cant use wordpress or any otehr thing has to be done froms scratch. If you can  just point me to the right direction that would be awesome

Since I just started working in the industry 4 months ago. This is a very big project for me and I am very confused as to what steps I should take. Any help would be greatly appreciated. Thank you in advance.

P.S. My boss wants a dedicated server

Toolbox: Live Chat, Code Conversion, Multiple Monitors, and More


This month, more of the tools you need to get your job done.

Scott Mitchell

MSDN Magazine December 2007

dynamically change html code when user is authenticated


So I have a fairly simple web site which allows an Administrator to edit some data in a database which is displayed on some web pages.

The main navigation on the site is shown in the code snippet below. The Admin link goes to a Login.aspx which allows the Administrator to log in - once authenticated they get sent to the data edit page.

So my question is, how could I dynamically add a link to the data edit page in the <ul> list below once the user is authenticated ?

This would allow the authenticated user to see links to the secure pages in the main navigation bar.

<%--Top Navigation Menu --%>
<div id="topMenu">
<li><a href="default.aspx">Home</a></li>
<li><a href="introduction.aspx">Introduction</a></li>
<li><a href="curriculum.aspx">Curriculum</a></li>
<li><a href="times.aspx">Times & Fees</a></li>
<li><a href="staff.aspx">Staff</a></li>
<li><a href="login.aspx">Admin</a></li>
</div><%--End of topMenu Container--%>
<div id="clear"></div><%--Floats items cleared End of Master Page--%>

Extracting Infopath form templates (with code behind) from a farm



I am in the middle of a migration of MOSS 2007 on server 2003 R2 to server 2008 r2, to be in the position to migrate to SP 2010. I am trying to extract form templates (with code-behind) from the old farm to the new farm. I did not set this farm up myself, so I would have copies of everything that was deployed to the farm, but now I don't. I have tried grabbing the .xsn from the Form Templates form library, and the form comes over, but no code behind, it says, The VB or C# project for this form template cannot be found. I have also tried extracting the solution files, and changing the file ext to .cab and opening the file up, only to find nothing very useful.

I need to extract and open the code up because I believe one of the forms that sends emails dynamically, is pointing to an old exchange server, because the emails are not getting through, and the exchange server was recently changed.

Any ideas would be much appreciated.


Running multiple websites in Sharepoint 2007 with AX2009 Enterprise Portal


I need to setup two separate webshops with public access and different layouts using AX2009 Enterprise Portal.

However I am uncertain how to implement two completely different layouts/designs because the Sharepoint Templates are located inside the 12 hive and not seperate for each website.

Can anybody give me some hints on how to do this - and if so, which requirements I have to meet (VSS 3.0 or MOSS Standard / Enterprise) in order to do it.

I am speculating whether I need to setup two separate web-servers with each own Sharepoint installation (and Business Connector Proxy)

Thanks in advance


How do I change the default HTML code for a collection of lists and views


I have modified the html display code of some lists and content query web parts in SharePoint designer.  This works well when modifying a few lists, but I have many lists and different views with these many lists.

Is there a way to modify the template code for a site so that all my lists, views and CQWPs display identically with my modified code?  Managing these individually is not practical.

VB.NET - store HTML code in SQL Server


Hey guys/gals!!

Quick question - I want to allow someone to enter HTML markup in a control, and save the input exactly as entered. 

I want people to put a minimum of 50 words, to maximum of 500, and be able to save the formatting of their text in SQL 2005 server database. 

Also, I understand this is two questions, but how do I save metadata of an image file in the sql database? I mean, I get the gist of it, but how do I do it? 

Thanks everyone!

Extract text from html source code

i wan to extract Desired Title,Desired Text and Desired link from Webpage source code and paste in richTextBox1. <a href="/site/show/link/0/type/0">Desired Titl e</a> <a title="&lt;b&gt;Text preview&lt;/b&gt; &lt;br/&gt;Some Text" class="pdtip" href="/site/show/link/0/type/0">Text</a><br />Desired text <br /> <label class="url" for="">http://Desiredlink.com </label> Output: Desired Title Desired Title Desired link How can i do this?

Making Outgoing call Code

// class declaration /* * The dictionary is used here to cache all telephone sessions using * unique SIP as dictionary key. */ private Dictionary<string , IUccSession> callSessions = new Dictionary<string , IUccSession>(); ... // class code string remoteTelUri = "sip:14055550100@contoso.com;user=phone" ; protected IUccSession SessionOut = null ; // class object with protected access public void MakePhonecall(string remoteTelUri) { if (remoteTelUri == string .Empty) return ; //using session manager created in OnEnable callback function, create session and set session type to audio/video SessionOut = this .sm.CreateSession( UCC_SESSION_TYPE.UCCST_AUDIO_VIDEO, null ); //advise new session of session event handler (this) UCC_Advise<_IUccSessionEvents>( SessionOut, this ); //advise new session of session participant collection //event handler (this) UCC_Advise<_IUccSessionParticipantCollectionEvents>( SessionOut, this ); UccUriManager uriMgr = new UccUriManager(); UccUri uri = uriMgr.ParseUri(remoteTelUri); //create a session participant using the passed SIP uri IUccSessionParticipant p = SessionOut.CreateParticipant( uri, null ); IUccAudioVideoSessionParticipant avP = p as IUccAudioVideoSessionPartici

DataGrid ValidationRule or IDataErrorInfo validation code called multiple times for each data change

Following my enquiry regarding a problem in Datagrid validation, for which managing exceptions is apparently a problem, I tested the two other methods: using validation rules, or implementing the IDataErrorInfo interface. I ran into other problems there, more insidious this time. This has been done on Windows7 (32-bit), .NET 4.0.30319. 1) IDataErrorInfo When this interface is implemented, the this[string columnName] property is called four times for each modification: two times before the cell enters edit mode (with the old value in the corresponding property) two times when the new value has to be validated (with the new value) It strikes me as not really efficient, is there something wrong with my code? Here's the C# part: using System; using System.Windows; using System.Collections.ObjectModel; using System.ComponentModel; namespace DataGridTest2 { public partial class MainWindow : Window { ObservableCollection<User> users; public MainWindow() { InitializeComponent(); users = new ObservableCollection<User>() { new User { Name = "Teddy", Age = "2" }, new User { Name = "Avi", Age = "19" } }; datagrid.ItemsSource = users; datagrid.Focus(); } } public class User : INotifyPropertyChanged, IDataErrorInfo { string name; public string Name

Sharepoint: In Calculated Column, Code with multiple "IF" condition does not work.

Implemantation:  Calculate expected resolve date exclude "Saturday" and "Sunday"  based on Priority and Severity.Columns are:1. Priority:2. Severity:3. Raised on: Date record createdCode: Below is the code which contains multiple "If" conditions. For quick undersatnding, i separated major If condition. Below code does not work and sharepoint gives me Sytax error message. =IF(OR(Priority="Critical",Severity="Critical"),IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+3,[Raised on]+1),     IF(OR(Priority="HIGH",Severity="HIGH"), IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+4, IF(TEXT(WEEKDAY([Raised on]+2),"dddd")="Saturday",[Raised on]+4,[Raised on]+2)) ,   IF(OR(Priority="MEDIUM",Severity="MEDIUM"), IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+5, IF(TEXT(WEEKDAY([Raised on]+2),"dddd")="Saturday",[Raised on]+5, IF(TEXT(WEEKDAY([Raised on]+3),"dddd")="Saturday",[Raised on]+5,[Raised on]+3)) ) ,   IF(OR(Priority="LOW",Severity="LOW"), IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+6, IF(TEXT(WEEKDAY([Raised on]+2),"dddd")="Saturday",[Raised on]+6, IF(TEXT

How to handle differences in HTML code from different browser versions?

First of all I'm still very new to C# so be gentle :p I'm currently trying to make an application that can login to a certain website and search for some numbers and so on that I can put in an overview, just to save some time. The only thing I found that could do this is the WebBrowser control, and I've managed to make it work, but when I gave the program to a friend it failed. I think it has to do with the difference in browser versions (he uses Internet Explorer 7, I use the latest) and if that's the case I'm pretty clueless how to deal with the problem, since I don't even know what the differences in HTML codes are in each version, and it seems like a lot of work to adjust all the html code to check for accordingly. For example it was even so that & changed to &amp; in my application on my PC and that's only by using one browser so I dunno what happens with other browser versions. I assume that the WebBrowser control always uses Internet Explorer, even if for example Firefox is the standard browser, is this true? But to be sure I asked the friend to put his Internet Explorer as the default browser and still no go. So my question is: is there a relatively easy way to make sure that the program works on practically any PC, without me having to make exceptions for like version 1.6.7 or 1.6.8 (I have no idea what versions there are really)?

Validating Custom Types and Html.EditorFor() Templates?

I'm finding my self with the problem that if I do not show the Template for a "complex" object I have in the main view object I still get the errors in the summary. How do i get around this? I've got a model with say:   HouseType ->Persons (has its own editor template) ->Pets(has its own editor template)   In the create view I show each one depending if they are not null. But when I try to validate HouseType and say I have Persons not null and pets is null. I get errors of validation for pets. How do I get around this? -Thanks

Firexfox and SharePoint Forum - a reply shows html code

When users use Firefox to view SharePoint and are replying to a post of the forum\discussion board the reply box and view box already has the HTML code in. For instance the body field contains:- <div><br/><br/><hr/> <b>From: </b>Kevin Shilling<br/> <b>Posted: </b>03 August 2010 15:17<br/> <b>Subject: </b>CHRISTMAS IS COMING...<br/><br/> <div>Yes, I know it is only August but thinking ahead what do you think about hosting our annual Open Evening for local neighbours, suppliers and friends and family. Do you think it is a good idea or not? Let me have your thoughts before the end of September when planning usually starts.</div></div> Anyone come across this and found a fix? Regards Mike

Rich text field showing html code

I am an end user of Sharepoint. This issue only happens from my computer, not from any other within our organization. What happens is that when I edit an item in Sharepoint that contains a rich text field, HTML code is showing. Like so: <div class=ExternalClassC900CFF4F2BF4312A89133C01A6E3C96> Some text</div> This happens from any web browser. Sharepoint 2007 is used. I have Windows 7 x64. Any idea what is causing this?

multiple services to same code destination

I've been using WCF for years and have been in the 90 of the 90-10 rule.  Now I need to start using WCF in ways that don't fit neatly.  I find it exciting, actually.  But it's a lot harder to find the information I need.  So I'm turning to this forum.  I have two fundamental questions: 1. In the config file under the "service" tag, is the "name" attribute like the "codebehind" value in an asp.net page?  i.e., does this always map to the code that is called? 2. Is it possible to specify two difference services with two different endpoints go to the same code location?  If so, how would that code be able to determine which service was called?  I know I could implement two different code destinations that call on the same reused code elsewhere but I may not have that option given the state of our legacy code.

How to dynamically create HTML file from the code ?

Hi all,Precisely and concisely, I have aspx page that has only one button "Generate". If the user clicked on this button, one HTML page should be created. The created HTML page should have title "Home" and the Body should contain "Hello World". 1) What is the code that should be written inside "Generate" button in order to accomplish this functionality? 2) Assuming the HTML page gets created, How to store it inside specific folder on the local drive? Or how to store it inside DB? I would greatly appreciate any constructive input!
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend