I am using Angular inside my .NET app in VS2015. Everything works fine when inside my main page, I am also using various panels to display my data. So lets say that I have a controller named MainCtrl and is declared as such inside my Homepage.aspx
<div class="panel panel-default" data-ng-app="APP">
<div class="panel-body" data-ng-controller="MainController">
<asp:Panel ID="PanelTest" runat="server"></asp:Panel>
</div>
</div>
this controller has a variable named testmessage="Hello" and if I have {{testmessage}} inside my panels code then it displays, as it should, Hello. If I dont declare my controller in Homepage.aspx though, and instead declare it inside my user control just above the place where {{testmessage}} is located then it's as if angular is not recognized anymore and what I see in my rendered page is {{testmessage}} and not Hello.
Why is this, should I follow some other steps for declaring my various angular controllers inside a user control .ascx and ascx.cs?
After investigating a little bit it became clear that this is because all Javascript files that I include in my controller are loaded just above that controller, but angular and my APP declaration is done at the bottom of my body element.
Is there anything else I could do except from moving all my JavaScript declarations to my header?
Related
someone need help here :( !!
I have a bloc of authantification html code and a btn for login and another for register. These two buttons are in all pages but I don't want my authantification code to be loaded in every pages (Render***() in _Layout.cshtml). I want to inject this bloc code in the page on login or register btn clicked.
exp: client want to register after visited pageTwo (the authantification html code is not loaded yet), and then he press the register btn => at this time the authantification html code is loaded (injected) without loading the entire pageTwo.
My authantification html is a modal, just to give you an idea:
<div class="modal" style="z-index:10000"> ... </div>
My queation: how can I inject a view(html) in the view that has been already loaded by pressing on a button ?
Thanks for helping if it's not clear let me know, and sorry for the bad english :(
UPDATE
Is it possible without server side manipulation ?
If you don't want server-side code, you need client-side code.
When button is clicked, use javascript to load html (with markup of login form only) from server, insert it into your current page (into model dialog for example) and then show that form/dialog.
jQuery will help you with html manipulation and when communicating with server, later you can switch to vanilla.js for less javascript libs in dependencies.
I have been looking around looking for a solution for this issue but have yet to arrive to a solution that works. I was using this as a reference but couldn't get anything to work:What is the right way to '#include file' in MVC?
I have an MVC 4 project that uses a Razor for the views and I want to add an aspx page that contains a menu bar that I would to add to the _LayoutPage.cshtml. As of right now I have recreated the menu so it looks the same in my razor view but the issue is that when a change needs to be made to the menu.aspx page I have to make the same changes in my razor view.
So my goal is to just render this menu in my layout.cshtml page.
This is what i have right now but it does not work. Is there anyway to do this?
<div id="page-header">
#Html.RenderPartial("P:/menu/menu.aspx")
</div>
Place your .aspx file in Views foulder and then:
#Html.Partial("~/Views/WebForms/menu/menu.aspx")
Also, could be that it is not working becouse RenderPartial works other way, try:
#{ Html.RenderPartial("P:/menu/menu.aspx"); }
I am using ASP.NET 3.5 with C# 2008.
I want to use a JQuery dialog for showing error message.
For this I need to include a CSS, a JavaScript file into aspx page. Also have to create a <div> with specific Id or class and have to put some buttons like OK, Cancel inside it. Also have to put a label inside <div>. And have to create a <script> block which contains functions to Open or Close the dialog.
All this working fine in single aspx page. But now I want to use this across all the pages and also don't want to make repetitive codes.
So what will be the best way to implement it? Should I put all these stuff inside a user-control and import it into every aspx page where I want to use that dialog? Or any other best way to achieve this?
You can put your javascript code into a js file and add the reference of that js file into your master page then you can call the jquery error dialog into your application.
We have an application which has menus generated dynamically through the publishing of a dynamic component presentation.A menu.xml is written out by a component template based on the Structure groups and this component template is triggered through event system to be published whenever a structure group is published.
This setup was working fine until the upgrade of Tridion 2011 from Tridion 2009. But ever since the upgrade, the menus are not dynamically published and are requiring a re-publish of the menu component template every time there is a change in the structure group. We checked the event system and everything is fine there. Moreover, this republish of menu component template triggers problems in some other page menus.
On doing some debugging (we made the component template write out the pageURI it is working on at any instant), we find that the page URI that is being written out is wrong.
Below are the steps taken and conclusions arrived:
All erring pages have been checked; the DCP tag has correct attributes set in the JSP code
Additional TRACE statements were added to the Tridion tag library, this confirmed the following:
The XSLT was correctly retrieved from the filesystem
The cached menu was retrieved correctly from the cache
The XSLT was correctly transformed with the variables provided
By writing out the XSLT attributes to the HTML we see that the XSLT processor is being provided wrong parameters.
So can I safely conclude that the issue has been isolated to the following event; the XSL processor is being called with an incorrect page id. Most likely cause is due to concurrency issues in the dynamic component presentation (DCP) java code where the DCP gets swarmed and starts confusing which page is using the current object.
And if this is the case, what can be done to rectify it.
Any information would help. Thanks in Advance!
Regards,
Keirthana T S
Update on 22-Jan-2013:
On more debugging, we find this issue to be recurring on the Presentation side(our presentation server) and the event system has nothing to do with the wrong menus appearing on the page.
That is, when we view a jsp page published from Tridion, we have the correct page URI for the top menu, left menu and breadcrumbs that we have:
<tridion:ComponentPresentation pageURI="tcm:57-186286-64" componentURI="tcm:57-103196" templateURI="tcm:57-23654-32"/><!-- privat-->
<div id="nav"><div class="wrapper">
<tridion:ComponentPresentation pageURI="tcm:57-186286-64" componentURI="tcm:57-23638" templateURI="tcm:57-23656-32" />
</div></div>
<div id="page" class="clear ">
<div id="content" class="clear">
<tridion:ComponentPresentation pageURI="tcm:57-186286-64" componentURI="tcm:57-23639" templateURI="tcm:57-23656-32" />
<div id="middle" class="rightcolumn">
<tridion:ComponentPresentation pageURI="tcm:57-186286-64" componentURI="tcm:57-23636" templateURI="tcm:57-23656-32" />
However, when we view the source of the web page, we find that the page URIs(we wrote out the page URI to html page) are messed up as below:
For
<div id="middle" class="rightcolumn">
which generates the breadcrumb we get a different pageURI instead of the correct one.
Some publish-related legacy (VB) events do not work out of the box with Tridion 2011. There is a legacy event adapter available here: http://sdltridionworld.com/community/2011_extensions/LegacyEventAdapter.aspx.
I'm running into what looks like a contradiction between jQuery Mobile and ASP.NET Forms. I have two pages that I'm transitioning between using jQuery Mobile page transitions. The basic structure looks something like this:
<html>
<body>
<div id="page1" data-role="page">
<form id="aspNetForm" runat="server">
Page 1
Page 2
<!-- Some more ASP.NET controls that require the aspNetForm -->
</form>
</div>
<div id="page2" data-role="page">
Page 2
Page 1
</div>
</body>
</html>
Notice that the form tag is only present in the first page. That's because ASP.NET only allows one form per page. When I try and move the form tag outside of the page divs jQuery Mobile starts acting strange (specifically the page transitions start looking strange). This becomes a problem when I want to use any sort of ASP.NET web controls that deliver input inside the second page.
Basically these rules exist that essentially lead to a contradiction:
ASP.NET:
1) All web controls that deliver an input must be within an ASP.NET form tag
2) Only one ASP.NET form tag can be visible (as in visible=True, not display: block) per page request
jQuery Mobile:
1) All content, including forms, must be within a page div
Can anyone think of a way to get around this? I guess I could restrict page2 to only use traditional HTML and not web controls but that doesn't seem like the most elegant solution. Any ideas? Has anyone else run into this?
Well. In my opinion, the simple solution would be to give each page its own .aspx-file. That would work just fine.
If your site is very big, it would also improve performance.