Link to home
Start Free TrialLog in
Avatar of chipsterva69
chipsterva69

asked on

converting files to web applications in Visual Studio

Good day!  I am new to Visual Studio 2012 and am running into an issue with coverting .ascx files into web application files, with .cs code behind files.

I am supposed to be able to right-click on the parent directory containing several files, all with .ascx as the file type, and select 'Convert to web application'.  This should then create .cs code behind files for each file in the directory (in this case, called Sublayouts).  I try to do this and the first file is adjusted correctly, but none of the others are.

I am not aware of any error messages being displayed.  The only message I see in the Error List window  is the following:

Validation (ASP.Net): Attribute 'placeholder' is not a valid attribute of element 'Sublayout'.

I check that part of the .ascx code and the code shows placeholder="content'

How do I correct this?  I have tried several other avenues of support to no avail.  

Thanks in advance!
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chipsterva69
chipsterva69

ASKER

Thanks for replying, The LearnedOne.  To the best of my knowledge, I am working on a model web site (this is part of a demo site used for tutorials).

Currently, prior to running the conversation, none of the files in this particular directory contain code behind files.  My understanding of the exercise is that once I have created a new file and saved it to the directory (Sublayouts), I should be able to run the convert tool on the higher up directory (Starter Kit) to automatically create the code behind class files.

When I run the convert, nothing happens, except to the first file in the directory, Breadcrumb.ascx.

The pages are mostly just HTML with asp declarations:
<%@ Register TagPrefix="sc" Namespace="Sitecore.Web.UI.WebControls" Assembly="Sitecore.Kernel" %>
<%@ Control Language="c#" AutoEventWireup="true" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<sc:Sublayout runat="server" RenderingID="{2BF352A5-6413-45DD-ABD3-2787356F555C}"
    Path="/layouts/Starter Kit/Sublayouts/Breadcrumb.ascx" ID="uxBreadcrumb" placeholder="content"
    Parameters="lang&amp;id&amp;sc_item&amp;sc_currentitem"></sc:Sublayout>
<div id="columns-C-and-R">
    <div id="content-col">
        <sc:Placeholder runat="server" Key="column-content" ID="columncontent" />
    </div>
    <div id="right-col">
        <sc:Placeholder runat="server" Key="column-right" ID="contentright" />
    </div>
</div>

Open in new window


Thanks for considering!
Conversion is not my area of expertise, but I am willing to try to help.  

Do you still have the original code before conversion?  

Can we try some different things to see what is going wrong?


What version of .NET IDE are you using?

What steps did you take to convert the Web Site model web site to a Web Application model?
Thanks for still trying, TheLearnedOne.

1.  Unfortunately, not without wiping out the practice site and restoring the tutorial, which I am happy to do if nothing else makes sense.

2.  At this point, I will try anything.  This one exercise is holding up the rest of the tuts.

3.  I am using MS Visual Studio 2012 Update 3.

4.  According the tut, to create the code behind files, it is a matter of saving the new file I created by doing a save as, then in the parent directory above the one the file is saved in, right-button clicking on the folder name in Solution Explorer and choosing Convert to Web Application.  The end result should be the typical ascx file, with two code behind files attached, for each file in the directory.

Regarding #4 - I have tried the conversion process on the new file's home directory and the one above it.  I have also tried it on the file itself.

Thanks again!
I am not sure that I understand what tutorial (or starter kit) that you are referring to.
My apologies - this is part of a larger move on our part to developing a SiteCore-based CMS website.  This particular issue came up while working with the tutorials that were part of our training several months ago, and I am trying to go through them again as a refresher.  I wasn't sure if all of the background was pertinent to the problem and didn't want to bury the problem with a bunch of extraneous info.
As an outsider, I am trying to understand your problem space, so that I can give you better guidance.
Yeah - it is a mess in there.  I don't want to waste any more of your time, TheLearnedOne.  I am going to get the site cleaned out and reinstalled and try the process again.  Thanks for giving it the college try - it isn't easy trying to understand someonelse's mess based on only what they can tell you!!

I appreciate the assistance.  You helped me decide to go back to step one and retrace the process.
While this comment wasn't the ultimate solution, it clarified for me what the process represented and where I most likely went wrong with it.  Thanks for helping clear the mist in my head!
When you create a web application, use the File > New Project > Visual C# > Web templates, which should give you what you need, since the default installation will use code-behind files.