master page in umbraco - c#

i'm programming in asp.net with umbraco and have a problem with master page.
i made a master page then added a web user master page that link in my default page.
at run time project in umbraco when i click on link saw this error :
Page not found
No umbraco document matches the url
'http://localhost:20771/WebForm1.aspx'
umbraco tried this to match it using this xpath query'/root/*
[#urlName = "webform1"] | /root// [#urlName = "webform1"]')
This page can be replaced with a custom 404 page by adding the id of
the umbraco document to show as 404 page in the
/config/umbracoSettings.config file. Just add the id to the
'/settings/content/errors/error404' element.
For more information, visit information about custom 404 on the
umbraco website.
This page is intentionally left ugly ;-)
i search in web and did not find any solution about it.

Check that your master page shows up in the admin area via Settings > Templates.
Then, check that your content page (in the admin Content section) has a template defined (under "Generic properties"). If it doesn't, and it doesn't let you select a template, then you need to allow that template to be used for that particular node type.
Go to Settings > Document Types, select your node type, and under "Allowed templates", select the template that you wish to us for the page (you may select a nested masterpage, it should still work just fine) - also make sure that the "Default allowed template" underneath is selected to your chosen template. Once you have hit "Save", go back to your node in the Content section, go to the "Generic properties" tab, and select the template you wish.
Umbraco lets you use any number of masterpages for rendering a content node. When creating new nodes, you then choose the template you wish to use (or use the default, as specified by following the above instructions).
You can also force a different template to be used at runtime, using the ?altTemplate=MyTemplateName querystring option on your page URL - handy for mobile sites, RSS views, and suchlike.

In Master.master page (it's general master page.) you can locate asp:ContentPlaceHolder
please attention to this code.Perhaps it's help you.
<div style="vertical-align: top;">
<umbraco:Macro ID="Macro1" Alias="NavigationControl" runat="server"></umbraco:Macro>
</div>
***<div>
<asp:ContentPlaceHolder ID="DefaultPageContent" runat="server">
</asp:ContentPlaceHolder>
</div>***
<div>
<asp:ContentPlaceHolder ID="TextPageContent" runat="server">
<!-- Insert default "ContactUsContent" markup here -->
</asp:ContentPlaceHolder>
</div>
<div>
<asp:ContentPlaceHolder ID="AtAGlanceContent" runat="server">
</asp:ContentPlaceHolder>
</div>
<div id="footer">
<uc6:FooterControl ID="FooterControl1" runat="server" />
</div>
</div>
</form>

Related

ASP.Net C# Master Site

I have a question about the ****.Master Site a in ASP.NET with C# (WebForms).
I've created a Site.Masters File with a lot of differente Placeholders inside. So the question is - is it possible to fill the Placeholders from different .aspx Files?
.Master Page:
<asp:ContentPlaceHolder ID="MainHeader" runat="server">
</asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="MainFooter" runat="server">
</asp:ContentPlaceHolder>
</div>
Now i would do something like this:
Adding some Content to the Main Header - the Content is represented in a file called mainHeader.aspx
Adding some Content to the Main Content - the Content is represented in a file calle mainContent.apsx
Is this possible or is there a solution for my plan? I would like to create a modular and flat structure of my .NET Project.
Thanks for your help - best regards
No, that's not how Master Pages work.
When the user/client requests an individual content Page, that Page is merged with the Master Page. The Master Page can not be called by the user/client.
I believe User Controls are what you are looking for.
You can do what you want by using jquery.load(), here is the documentation http://api.jquery.com/load/, however i think what you are doing is not the way to procede, in order to do what you want i suggest yo to do this:
Create User Controls, one for each master ContentPlaceHolder, then in your master, add each one of this and initiate them.

Click a tab button on website

I want to click tab buttons on website which runs on web browser with code below. I put "step2Tab" and "group1step2" as parameter but getting NullReferenceException error. How can i click these buttons?
webBrowser1.Document.GetElementById("step2Tab").InvokeMember("click");
Here is the html code
Step 3
Step 2
<a class="currentTab" href="javascript:donothing()" onclick="showTab(this,1,'step1')" id="group1step1">Step 1</a>
<div id="step1Tab" style="display: block;"></div>
<div id="step2Tab" style="display: block;"></div>
<div id="step3Tab" style="display: block;"></div>
I'm not familiar with the environment you're working in, you may need to be more specific but looking at other people having this issue (link, link) it appears you need to get elements by tag:
webBrowser1.Document.GetElementByTagName("step2Tab");
This will return an array of elements with that tag. You will then need to compare by the an attribute of the element:
GetAttribute("attribute")
I hope this is useful.

position a label in the end of a webpage(masterpage) in a c# webpage

Im creating a website in c# asp.net,i desgined the master page,i added a link(our email id,indicating we are the developers)but,the content pages have gridviews which are not paged,so the length of the gridview varies based on the data,in all content pages using this master page.Because the length of gridview varies,when its long,the link's position seems to be in the middle of the page.I want our link to be in the bottom of the webpage.How to do this,pls help.
I think you html footer might be more useful to you.
<footer>
<p>Developed by: user2740323</p>
<p>Contact information: <a href="mailto:someone#example.com">
someone#example.com</a>.</p>
</footer>
you can add a footerPlaceHolder to your masterpage like this:
<asp:ContentPlaceHolder ID="FooterPlaceHolder" runat="server">
<div>
your info
</div>
</asp:ContentPlaceHolder>

How to include header, footer, sidebar to webpage in asp.net c#?

I newly joined asp.net, I am little bit confused how to add header/footer to webpage?
I am using visual studio 2012.
We use include,require predefined functions in PHP.
I dont know what we use in asp.net for none changeable blocks for website.
Please advise me.
Thanks
Using Masterpages, allows you to create master copies of your header, footer, sidebar and what else. All your "content" pages inherit the masterpage, and renders in a predefined "content area" inside the masterpage.
Create a masterpage, it should have a default "content placeholder". Build your masterpage around it, and when adding a new page, choose "content page", or in earlier Visual Studio editions, page, and check the box that says "use masterpage".
You will then see your new content page with the masterpage faded out on the background, and you can build your content page.
Calling the content page (normal page that is bound to a masterpage), always renders the masterpage and the content page as one page to the screen.
use master page and add header div and footer as you need.
<div style="margin-left: 38%; width: 25%;">
Header
</div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
<div style="margin-left: 38%; width: 25%;">
<hr style="color: #1B3280; border-width: thin; width: 98%;" />
</div>
<div>
<asp:Label ID="Label" runat="server" CssClass="rights" Font-Size="12px" Font-Names="Calibri"
Text="All rights reserved."></asp:Label>
</div>

Accessing html controls within an #include html file, from server side c#

Following code is an example, I just want to know if this can be done.
I have an test.aspx file with this server side include tag;
<!--#include file="listOfCountries.htm" -->
Within listOfCountries.htm, I have:
<html>
<div>
<select id="countryList" runat="server">
<option></option>
...
</select>
</div>
</html>
Now, Is there a way to access "countryList" in test.aspx.cs file ?
On another note, say I didn't have the #include "Countries.htm" in test.aspx, is it possible to access the controls within Countries.htm from test.aspx.cs ? (i.e. accessing an external html file controls in cs)
As far as I'm aware, what you're asking for isn't possible as the include file isn't actually parsed as asp.net.
What you want to do is create a "User Control" by right clicking on your project, choosing "Add new Item" and choosing "Web User Control" from the window that appears.
Within your user control you can define the markup for "countries.htm", and then expose the contents of the <select> to your C# code.

Categories

Resources