I've got a Razor list-to-view function setup and i render a website url that a user inputs. My problem is that at the moment clicking the url causes the anchor to try and find that page within the website, when it's an external link.
How do i do this?
My code with the rendered URL:
<div id="PageDetails">
<h2> #artist.ArtistName </h2>
<p><strong>Website:</strong> #artist.ArtistWebsite</p>
<p><strong>Bio:</strong> #Html.C1().Body(artist.ArtistBio)</p>
#if (!string.IsNullOrEmpty(artist.Image))
{
<img src="#Html.C1().MediaUrl(artist.Image)" /><br />
}
</div>
The URL in the data type field should start with http://:
Use 'http://www.xyz.com' rather than 'www.xyz.com'
Related
I want to redirect from one view to another view in the same project/solution. There are 3 hyperlinks in here and I am unable to redirect to either of them. Can someone help me with this?
<body>
<div>
<br />
<span style="margin-left:20%"></span>
Forgot Login ID?
<br />
<br /><span style="margin-left:20%"></span>
Forgot Password?
<br />
<br />
<span style="margin-left:20%"></span>
Need to register your Corporation?
Click here
</div>
</body>
When I try to click on the hyperlink, I am getting the following HTTP 404 Not Found error. I tried many approaches, but none seem to work.
I tried different approaches to linking to the controller. But, I failed to get any positive output.
Asp.net does not have phyiscal routing - you do not want to link to physical files. Instead it resolves its routes after a pattern. The default pattern, unless specified otherwise is "{controller}/{action}/{id}".
So assuming your controller is called CorporationController, and your action method is called "ForgotPassword", the hyperlink would be constructed with:
#Html.ActionLink("Forgot Password", "ForgotPassword", "Corporation")
You might want to read some basic documentation about Asp.Net Mvc first.
I'm building a website for a school project. In a page i need a link to another page (profile.jsp) with params, because I need to do a query in that page. I've tried forward in JSP but it opens the page right away, I need to activate this with a link, or also with a button. Here I'm using windows.location but it doesn't allow me to give params as far as i now.
<div class="mask_container">
<h2><%out.println(title);%></h2>
<p onClick="JavaScript:window.location='profile.jsp';"><%out.println(autor);%></p>
<img src="img/like-white.png" class="social">
<img src="img/comment-white.png" class="social">
<img src="img/download-white.png" class="social">
</div>
how about passing your parameter values in query string as shown below, instead of <p> tag put below <a> tag to redirect to another page
<%out.println(autor);%>
You can get value of parameter on other page using request.getParameter("param") this will gives you parameter value.
May this will help you.
Greeting,
I am trying to use local anchor in a web page, but it doesn't work. The local anchor's URL like this:
https://hostname:port/info?newElement=true#a
If I use this URL to load the web page directly, I can see the web page is located in the correct position where the local anchor is. But if I click the hyper link in the web page, nothing happens, though I can see the URL is correct in the footer when I hover mouse on the hyper link.
The web page is not reloaded and the URL in the browser's address box is not changed to the URL with "#a" at end. Is it due to the web page is an active web page?
Below is the code sample:
"form.jsp":
<div>
<div>
<jsp:include page="form-nav.jsp" />
<div>
<jsp:include page="form-location.jsp" />
....
</div>
</div>
</div>
"form-nav.jsp":
<div>
<ul class="tab">
<li>
Name
</li>
....
</ul>
<div>
"form-location.jsp":
<div id="location" class="page">
...
</div>
Thanks,
Zhe
DEMO
Here is an example of how to use the anchor tag.
Anchor syntax:
Link text
Referenced Element:
<div id="someid">You content goes in here</div>
everyone,
by further codes reading, I found the problem now. There is a override of the hyper link's click behavior in a js file:
$("body..... ul.tab li a").on('click', function() {
...
return false;
})
By deleting this override logic, the local anchor works well now. Thanks a lot for your comments!
So, my boss has this crazy idea - the whole website working on one single page. So far - still ok, but here's the thing:
- the different pages have different divs with content (like usual), and when some div is clicked (or link in it) some of the divs expand/collapse, working in the way of revealing different content. That's fine, but...
he doesn't want to use JavaScript or anything for dynamic view of the website ('cuz I am leaving in 2 weeks and him and the other employee are not capable of JS, thus cannot improve/maintain if needed)
his idea is to have the HTML code, for all the pages variations of the website, stored in the database, and upon clicking some link - reloading the page with the certain HTML. So not different .html files for every page, but only one for all of them.
The problem is that it works for the first page that I load, initially, but then when I call another page, it gets twisted, since I call the function, that retrieves the HTML, but the other call of the previously loaded page is still there, so it calls again. Here's sample, so you understand:
<script runat="server" type="text/C#">
public string getPage(string name)
{
string page = "null";
switch (name)
{
case "media":
page = getMediaPage(); <!-- just function from the code-behind that retrieves the html code from the DB and passes it to the page -->
break;
case "home":
page = getHomePage(); <!-- just function from the code-behind that retrieves the html code from the DB and passes it to the page -->
break;
}
return page;
}
</script>
</head>
<body onload="addEvents();">
<form id="form1" runat="server">
<div id="parent">
<div id="presentation">
SomeCompany ApS Street3 | CITY | INFO#Comapny.com TLF: 999999
</div>
<%=getPage("home") %>
</div>
</form>
So that's how the initial page will be and then just in the parent div I will call the HTML for the other pages. One example of HTML, stored in the DB:
<div id="mainmenu">
<b>HOME</b>
<br />
PRODUCTS
<br />
SUPPORT
<br />
CONTACT
<br />
ABOUT
<br />
</div>
<div id="logo">
</div>
So I call this chunk of code slam it in the page. The twist happens as I have <a href="<%=getPage("media")%>"> clicked, so it loads the page normally, but there is <%=getPage("home") %> standing statically in the page, ALL THE TIME, as I need to start from somewhere, and it attempts to load the previous page again, and... server error.
I know it's kinda stupid idea, but I can't argue with him anymore.
So my question is - is there way of handling all this with some kind of OnClick(Event e) or some other way out, with calling different functions (as I already started).
Or I should just tell the boss that it's not gonna work this way...
As stated, this isn't a great idea, but you could get it to work by using some Web Controls.
Where you have <%=getPage("home") %> in your page, change this to:
<asp:literal id="ltlContent" runat="server" />
On Page_Load call:
ltlContent.Text = getPage("home");
Any links on your page which should load other content, change these to LinkButton controls, and their click events could have:
<asp:LinkButton id="linkMedia" runat="server" onclick="LoadContent" CommandArgument="media" />
public void LoadContent(object sender, EventArgs e){
ltlContent.Text = getPage(e.CommandArgument);
}
you could try the parameters on the get url.
add them on your link "?page=media"
and then you parse the url when you arrive $_GET["page"]
This is my first time posting here.
My website has a portfolio page written in HTML5. On the page, I have multiple HTML links to different galleries.
<a href="#II">
which presumably calls
<article class="col2 pad_left1 tab-content" id="II">
<ul class="gallery">
How do I directly call each gallery from an HTML link from another page?
Thanks,
Grayson
By prepending the other page's url to the href value:
Foo
You put a href in your link as you did. The url than looks like: www.example.com#hrefYouPut. On document ready you do an if clause:
var hash = window.location.hash;
if (hash == "#hrefYouPut") {
//my gallery pops up in here
}