Can we load ascx or aspx page using angularjs into html - javascript

Can we load ascx or aspx page using angularjs into html control ?
This is the structure I have,
SharePoint MasterPage
SharePoint Webpart
Html page (partial view)
How to load ascx or aspx page here ?>
Now I need to load aspx or acsx page dynamically.
WorkAround 1
I can think of one work around, which is to load this user control in SharePoint Webpart then hide it, and only show when needed, but I think there might be an easier way...
WorkAround 2
using IFrame I load the page.
Is there any better way ?

Related

How do you link an ASPX file to a different html file in Visual Studio?

I am confused, how would I be able to link an ASPX file in Visual Studio from a different folder within the solution? So I have the Solution for my web ASPX site, and I have another folder that contains all of my html/css/javascript/images. How would I communicate between the two and have an HTML page link to the ASPX site?
I know the code should be: View Reports right?
You as a genreal rule need/want/should/will palce those aspx pages in your current project folder. The reason of course is that "folder" becomes the root folder of the web site when you publish.
so, if you have some other aspx pages that you want to use? then from vs choose add->existing item, and then you can browse to that aspx page. This is really a SIMPLE IMPORT of that page into the current project.
So, the web pages and folders MUST exist in your current project, and you are NOT free to reference or use or have aspx pages outside of your current project. The web site layout will not work correclty.
Now, you can ceratinly refernce other projects "code" and things like other libraries of code. But a aspx web page is going to be converted to standard HTML for a browser, and those aspx pages will become the url of the web site, and thus all such pages must be in the root of the project, or in sub folders of that root project.
So, you might have:
Welcome.aspx
but, you can say add a new folder to this project, and maybe call it
SiteAdmin
So, now, you can place aspx pages in that folder, and your URL will become:
http:mycoolebsite/SiteAdmin/Manage.aspx
so, yes, all aspx pages have to be part of the starting folder for the web site.
it not at all clear what you mean by "link".
I mean, one can have page1.aspx, and then page2.aspx.
you can the drop a button in page 1, and when you click on it, it jumps to page2. This would not really be called "linking", but navagation to another page.
You can thus of course add a hyper-link in page one. or you can drop in a button, and with some code jump/navigate to that page2.aspx.
So, assuming I have page1.aspx, and page2.aspx, then you are free to drop in a button, say like this:
<asp:Button ID="Button1" runat="server" Text="Jump to page2.aspx"
OnClick="Button1_Click" />
And code behind could be this:
Protected Sub Button1_Click(sender As Object, e As EventArgs)
Response.Redirect("~/page2.aspx")
End Sub
But, you don't have to use code behind, and you can say drop in a hyperlink control, and do this without code.
eg:
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="~/About.aspx">HyperLink</asp:HyperLink>
So, you can jump/navagate from a html page to a aspx page by using a hyperlink.
If this is a html page, then use a html control, not a asp.net one, and thus use:
About our site
So, you can use a plain jane hyper link, and use one in a aspx page, or a html page

Multiple ASPX Pages using the same JavaScript / CSS Scripts

I am using the same CSS links and JavaScript scripts on numerous Web Forms ASPX pages on my website. So the head section of my pages are practically the same, bar a few exceptions.
I was told to look at Master Pages for Web Forms.
Is there somewhere I can store the duplicated scripts/links, and call them on each page, rather than placing the links in each head section?
yes you can use masterPage head protion where you have to place links only once and by binding pages to this master page links will get attached with all pages.If you want any other link other than this you can use content place holder in head portion and use that in the particular page

load javascript widget into wordpress page

Morning,
I have an affiliate external widget i need to place on a page in wordpress.
The official code i have been given loads external content within this page.
<script type="text/javascript" src="http://www.convert.co.uk/widget/mobiles.js"></script>
where you place the line of code is where the external content is displayed.
This works perfectly on a non-wordpress site.
Once loaded the content uses some jquery effects and ajax to swap the results.
If i add this code within a wordpress page, it loads the content fine but the jquery within the external content does not work.
many thanks.
I do not have access the external code to change.
In the backend in the widget screen, drag and drop the text widget in the place where you need to display this external widget. Now, just add the code you have to that text widget and save it. You should now see your widget on the front end

ASP MVC javascript lazy loading

in view, i have at the bottom many javascript and jquery code, and i dont like it, so im placing all scripts into one ascx file, and make partial rendering like:
<!--<%Html.RenderPartial("~/Views/Home/StationLogics.ascx"); %>-->
of this ascx file with scripts. So, is there any better way?
cant place it to master page, cause not always i need this scripts, if user get some privilage, he can use some scripts, if not - others
it mat not be what u intended to know but i think that u can place all ur javascript and jquery code in a js file like in yourjavascript.js file and place a reference of js file in your view or the master page page file that the view is inheriting e.g.
<script src="<%=ResolveUrl("~/scripts/yourjavascript.js") %>" type="text/javascript"></script>
You could add your common JavaScript files in the head element of a Master page, and then let your pages reference that master page using the <%# Page %> directive, for example:
<%# Page MasterPageFile="/Views/Shared/Site.Master" %>
Now, all you have to do is update the scripts in your master page, and pages referencing that master page will have the scripts as well.
However, if your scripts are too specific to include in the master page, then your solution is probably fine.

Javascript in .ascx file

I have .ascx controls which I load on the page using renderpartial. I have need where in I want to hide some Div tag on the page where I am loading the control.
I added a Javascript to the .ascx file, but it seems that it does not get included in the page and hence I cannot hide the DIV tag when I load the control.
Any help??
You should view source of your control and also if you are using update panel on the page and loading the script at runtime then it may be the root cause as well.

Categories

Resources