I have an html template, that describe the position of each control and templates are getting from database. I have added certain custom tags like [txt],[chk] into html template. I want to replace this tags with asp.net controls like textbox,checkbox etc... at the time of page rendering. so i can write c# code on these controls.I want to implement these things on code behind.
If you are using ASP.net web forms, simply copy your HTML template into an ASPX page and replace your placeholders with the relevant controls you want to use.
If you are using ASP.Net MVC, then you can use Razor to do this. http://weblogs.asp.net/scottgu/introducing-razor
Related
I'm creating a new website and I will have different pages on it. However, instead of creating new HTML files for each page and an anchor for each, I want all my pages contained in one HTML file. Is it possible in any way?
You can try Vue js or React js or many js frameworks ... which contain components.
Using HTML
You can control HTML page section how tabs working in HTML, take a look in Bootstrap Tabs, or you can hide/show sections using CSS or using JS, you may store HTML for each page in array of js and load that HTML to Body based on URL you create
Using Server Side Language
Also if you need single page application with multiple pages you need a Server Side language, where Database contains your website configurations and you can load based on the URL each page's layout or text like heading forms etc...
I have pretty simple landing site (index, faq, about, contact) based on ASP.net MVC. Of course, I use Layout (with head and footer), every View contains just page content. The problem: some pages has unique footer or head.
For example:
Index page has carousel (only this page, other pages has no carousel).
In source HTML (that web-designer sent me) I see scripts links in the head and scripts block in the end. Yes, I know: I can use Razor tag "#section" and declare this non-standard head and footer inside my view.
But! It means my view (page content) includes razor syntax. This is not pure HTML. What if site admin will want to edit index page - he will see Razor tags, he can't use some html editor or online tool (TinyMCE) for edit. He must know Razor. He can't just insert pure html.
Maybe I shouldn't keep page contents in DB? (but this site must support multi-lang). What is the best approac in this case?
Thanks.
Is it any ways to add html and css code to page templates using UI of lifery? Because when I'm opening page template - > add page template I've got smth like this with this strange message
It is not possible to specify customization settings for pages in site
templates or page templates.
How to write my own template with custom CSS and Pictures that I have already added to my custom theme?
Your screenshot is helpful. See the Look and Feel tab? That's where you can add custom CSS. Custom JavaScript logic can be added in the Advanced tab.
I'm new in liferay, into my portlet i have html pages with angularJs not jsp.I would ask about how to navigate between these html pages into my portlet..thanks.
I think you are bit confusing about technology.
JSP pages always generate HTML page for your browser.
It means that you create a JSP page containing just HTML nothing changes (this is correct from a developer point of view... thinking to server job this is not true... but think it is true for our purpose).
Client side technology you are going to use is not relevant from a portlet point of view (it can be a problem if your theme uses some not compatible libraries...) but in general whatever library you use (angularjs, backbone etc.).
It means that you can create html or jsp pages containing all the angularjs code you want... and everithing should work fine.
If you want to manage navigation between "pages" in the same portler (e.g. from view.html to details.html) then you have to mind, simplifying, that portlets haven't pages: your portlet will be added in a page of the portal (with its own URL).
So you can rename your html files in jsp files (as I told, nothing changes), then you can tell to portal what is the correct URL to load by JSP code.
For example for making a link to "details.jsp" in your "view.jsp" you can write a code like following:
<a href="<portlet:renderURL>
<portlet:param name="jspPage" value="/path/to/your/details.jsp" />
</portlet:renderURL>">Text</a>
Obviously you can use the <portlet:renderURL>...</portlet:renderURL> code wherever you want... because it will be translated in a string before sending to browser... like in javascript var url = "<portlet:renderURL>....</portlet:renderURL>"
You shouldn't forget to put these lines at the beginning of yout jsp files:
<%# taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<portlet:defineObjects />
I have ASP.Net MVC 5 application with Layout.cshtml and I have included the HTML view page. But I want to keep the consistent look and feel across multiple views in my application. I know I can do this if I have a Razor view page:
#{
Layout = "~/Views/Shared/_Layout.cshtml";
}
If I'm also using the same above code on the HTML View page, it doesn't pick up the Layout as it does in Razor page.
In html page you can't call '_Layout.cshtml' file directly to use layout , you have to add style and html tags manually in new created html file which you have in '_Layout.cshtml'. There is an option to call '_Layout.cshtml' using iframe but it is useful only if you don't want to apply server side logic, which is of less possibility.