Server-side Navigation Menu Based On Html Contents?
Jul 9, 2010
I need to do some styling to a bunch of webforms, containing articles formatted in a rather uniform way. I can change any source code I want.
What I need is a quick way to dynamically create a navigation menu (on the server side) for an ASP.NET webform, based on contents of a specified div.
For example, given the following HTML:
<div id="article">
<h2 id="first">Chapter 1</h2>
<p>Some text...</p>
<h2 id="second">Chapter 2</h2>
<p>Some other text</p>
</div>
I would like to insert something like this at the end (and render it at the server side, not in a script):
<div id="navigation">
<ul>
<li><a href="#first">Chapter 1</a></li>
<li><a href="#second">Chapter 2</a></li>
</ul>
</div>
NOTE: I know I could iterate through parent div's child controls in codebehind (although I would need to make them all "run at server", or even parse the InnerHtml property of the parent div), but if feels pretty weird.
Also, I am aware that if the article was being created from a data source, I would have the content already organized, but I would like to make as little changes needed in the existing pages.
View 2 Replies
Similar Messages:
Mar 21, 2011
My master page is left navigation bar. It displays correctly on my aspx pages, but the other content of the aspx page is displayed right underneath the master page content. I don't want anything to be displayed under the left navigation bar. I want the other stuff to be displayed on the right side of the navigation bar. Is their any way I can do that. below is my code
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/NavigationMenu.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<%@ Import Namespace="CIS_NG.Models.Menu" %>
<asp:Content ID="Content1" ContentPlaceHolderID="titleContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server" >
<h2>Welcome to CS page</h2>
</div>
</asp:Content>
i want the "welcome to Cs page" displayed right next to my left navigation bar that is coming from my master page. I can do this to avoid it
<div style="text-align: center;"><h2>Welcome to CS-NG</h2>
but I thought if I write somthing in the content page, it will automatically come to right side of the page.
View 3 Replies
Aug 25, 2010
Iam using masterpage and i want to use navigation menu ,but i don't want to use sitemap concept
how to work with navigation menu and assign the pages in navigation menu in master page
View 2 Replies
Feb 28, 2010
I want to have a side navigation menu (Vertical Orrientation) for a master page. Now the problem is, when I created a web form and include my created masterpage, the objects inside the content placeholder of a webform appears in the bottom of the side navigation menu. I want to make the objects appear at the right side of my navigation menu. How can this be done??
View 3 Replies
May 19, 2010
I'm developing a Portal to a school
I need to login (ok)
I also need when the login is ok, to add some buttons to navigation menu, taht is created in the Master Page.
Is it possible?, how?
i already handle the page load on the default page.
View 3 Replies
Dec 21, 2010
I know that setting runat="server" and specifying an id for an iframe control, makes it accessible on the server side but what I need is that the iframe source contents get loaded at server side not client side.Is it possible?Why do I need it this way?
Currently my iframe source site is configured for ntlm authentication and sso which means it would read my windows credentials whereas I'd need it reads the credentials provided by the site which hosts that iframe.
View 2 Replies
Oct 29, 2010
I have created a basic horizontal menu in MVWD 2010 which works when I debug it on my own machine. But as soon as I upload to a ASP.net 3.5 sever online, the dynamic aspect doesnt work. Are there some major differences in frameowrk 3.5 to 4?
View 3 Replies
May 7, 2015
i  want  get  html  inside  div
<div id="ss" ></div>
View 1 Replies
Jul 10, 2010
I added a menu avigation control in my page and i did this:
<div style="background-color: Maroon">
<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal" ForeColor="Black" Font-Bold="true"
BackColor="Chocolate">
<Items>
<asp:MenuItem Text="Home"></asp:MenuItem>
<asp:MenuItem Text="About Us"></asp:MenuItem>
<asp:MenuItem Text="Services"></asp:MenuItem>
<asp:MenuItem Text="Careers"></asp:MenuItem>
<asp:MenuItem Text="Contact Us"></asp:MenuItem>
</Items>
</asp:Menu>
</div>
but i cant give proper spacing between the menu items right now it is appearing like this: how to give proper spacing between the menu items them?
View 14 Replies
Aug 7, 2010
i can use escape() and unescape() functions by Client side easily, but the problem when i have use escape() method for peice of HTML , then i dont know how to unescape this piece of HTMl By Server Side not By Client Side. how i can unescape (escapped HTML) by server side?
View 2 Replies
Jun 14, 2010
I want to enable comment posting on my page, so i need to execute some html encoding before post is sent and inserted into a database. What is the ideal side for this? Sever side(I work with asp.net) or client side (javascript)?
View 4 Replies
Jun 16, 2010
I'm using asp.net and css to style a master page with navigation at the top. I was hoping to add the login status control in as a menu item but it is not allowed. Can someone point me in the right direction? When I post my code on this forum do I have to include tags?
View 4 Replies
Aug 19, 2010
I've buit a menu functionallity in my MVC app where you can add/remove and modify navigation items:
this is what it looks like in the database (the key thing to notice here is URL field where i'm storing all Area/Controller/Action/Param values.
Now, on the front end I would like to built <UL><LI> menu from the db.
How would I know what page I'm on so that I can add class "current" to <li>. If for example I'm in "http://localhost/Admin/Admins/Dashboard" how would i know it applies to /Admin/Dashboard AND /Admin/Dashboard/Index?
-another thing. how would i handle params. For example when I'm on page /Admins/ContactUs/Edit/32 - how would i match this to /Admin/ContactUs/Edit/ ?
View 1 Replies
Jan 6, 2011
How to show menu with sitemap based on sql server data?
View 1 Replies
Aug 13, 2010
I want to filter a grid at server side based on the value typed in a text box. And the filter should happen as the user types in text box. Since there is no server side event like keypress on a textbox, I decided to do use the client side onkeypress event and call a server side code using PageMethod. But then ran out with the limitation of PageMethod being static and I can't access grid from server side code.
[code]....
View 1 Replies
Jan 27, 2010
Anyone know how to create a menu like the thegatesnotes.com ? Can we custamize the treeview control like that?
View 1 Replies
Jan 11, 2011
I am putting a navigation menu with in a div but the menu in aligned correctly. I want it to aling to top but it is being placed at the bottom.
Here is the script:
<%@ Master Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>Super Dream Mattress Co. </title>
<meta name="description" content="Super Dream Mattress Co. - Scorland only Memory Foam Mattress Manufacturer. We Manufacture Foam Toppers, Double Mattresses, Single Mattresses and Kingsize Mattresses. Free next day delivery on items, contact us online or call
0141 810 4333" />
<meta name="keywords" content="memory foam mattresses, memory foam toppers, memory foam double mattress, memory mattress, memory foam mattresses, Super Dream Mattress Co, Superdreammattressco" />
<script type="text/javascript" src="script.js"></script>
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
<!--[if IE 6]><link rel="stylesheet" href="style.ie6.css" type="text/css" media="screen" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" href="style.ie7.css" type="text/css" media="screen" /><![endif]-->
<style type="text/css">
.newStyle1
{
font-family: Arial, Helvetica, sans-serif;
font-size: medium;
}
</style>
</head>
<body>
<div id="art-page-background-simple-gradient">
</div>
<form id="form1" runat="server">
<div id="art-main">
<div class="art-Sheet">
<div class="art-Sheet-tl">
</div>
<div class="art-Sheet-tr">
</div>
<div class="art-Sheet-bl">
</div>
<div class="art-Sheet-br">
</div>
<div class="art-Sheet-tc">
</div>
<div class="art-Sheet-bc">
</div>
<div class="art-Sheet-cl">
</div>
<div class="art-Sheet-cr">
</div>
<div class="art-Sheet-cc">
</div>
<div class="art-Sheet-body">
<div class="art-Header">
<div class="art-Header-png">
</div>
<div class="art-Header-jpeg">
</div>
<div class="art-Logo">
<h1 id="name-text" class="art-Logo-name">
<a href="~/Default.aspx">
Super Dream Mattress Co.</a></h1>
<div id="slogan-text" class="art-Logo-text">
Dreams in Comfort</div>
</div>
</div>
<div class="art-contentLayout">
<div class="art-sidebar1">
<div class="art-Block">
<div class="art-Block-body">
<div class="art-BlockHeader">
<div class="l">
</div>
<div class="r">
</div>
<div class="art-header-tag-icon">
<div class="t" >
Menu</div>
</div>
</div>
<div class="art-BlockContent"
<div class="art-BlockContent-body">
<div class="cleared" >
<asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1"
StaticDisplayLevels="3" valign="top">
<StaticMenuItemStyle VerticalPadding="0px" />
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
</div>
</div>
</div>
<div class="cleared">
</div>
</div>
</div>
<div class="art-Block">
<div class="art-Block-body">
<div class="art-BlockHeader">
<div class="l">
</div>
<div class="r">
</div>
<div class="art-he
<div class="t">
Highlights</div>
</div>
</div>
<div class="art-BlockContent">
<div class="art-BlockContent-body">
<div>
<p>
Super Dream Mattress Co. become members of the National Bed Federation.</p>
<p>
<img alt="Super Dream Mattress Co. become member of the NBF" class="style2"
src="images/nbf_logo.gif" align="middle"
style="z-index: auto" /></p>
<p>
<br />
</p>
</div>
</div>
</div>
</div>
</div>
<div class="art-Block">
<div class="art-Block-body">
<div class="art-BlockHeader">
<div class="l">
</div>
<div class="r">
</div>
<div class="art-header-tag-icon">
<div class="t">
Contact Info</div>
</div>
</div
<div class="art-BlockContent">
<div class="art-BlockContent-body">
<div>
<img alt="an image"
src="images/contact.jpg"
style="margin: 0pt auto; display: block; width: 95%;" />
<br />
<b>SuperDream Mattress Co.</b><br />
Unit 3a Pegasus Business Park<br />
Hillington, Glasgow<br />
Scotland, G52 4TY<br />
Email: <a href="mailto:sales@kayfoam.co.uk">sales@kayfoam.co.uk</a><br />
<br />
Phone: 0141 810 4333<br />
Fax: 0141 810 1423
</div>
<div class="cleared">
</div>
</div>
</div>
<div class="cleared">
</div>
</div>
</div>
</div>
<div class="art-content">
<div class="art-content">
<div class="art-Post-body">
<div class="art-Post-inner">
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
</div>
</div>
</div>
</div>
</div>
<div class="cleared"
</div>
<div class="art-Footer">
<div class="art-Footer-inner">
<a class="art-rss-tag-icon"
title="RSS"></a
<div class="art-Footer-text">
<p>
Contact Us</a> |
Terms of Use</a
Trademarks</a> |
Privacy Statement</a><br />
Copyright © 2011 ---. All Rights Reserved.</p>
</div>
</div>
<div class="art-Footer-background">
</div>
</div>
<div class="cleared
</div>
</div>
</div>
<div class="cleared">
</div>
<p class="art-page-footer">
Kayfoam</p>
</div>
<div>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
View 2 Replies
Feb 14, 2011
I need rft server control not HTML based server controls to display and store text as well as images, from which i can get rtf text and can save it as it is in DB.
View 1 Replies
Mar 31, 2011
How can I show an AJAX modal popup based on some code logic and NOT based on a button to be clicked? For example:
if (!User.Identity.IsAuthenticated)
{
Show a modal popup here which says: 'This process is only available to users who are logged into the system.'
}
View 3 Replies
Jan 16, 2010
[Code]....
I want to be able to make the first line blank, in this case "about us" and still keep the same dyamtic alignment on my nav menu. Right now, if i take the "about us" title text out, it messy up my dyamtic or on hover nav menu. What would be best is i can replace those letters with spaces but it won't work with just blanks. Any idea on how i would not display the "about us" but keep everything as is?
View 5 Replies
Jul 11, 2010
I'd like to make navigation menu like one in [url=http://www.eveonline.com/]here[/url]. I thought about using TreeView, but I couldn't make "collapse" indicators to disapear. If I set ShowExpandCollapse property to "false" those indicators disapear, but tree becomes expanded and static. That's not what I want to achieve.
View 2 Replies
Nov 9, 2013
How can I add a logout link to my navigation menu. I have horizontal dropdown menu.
View 1 Replies
Apr 5, 2010
I would like to know how a browser based POST request is converted to server side event like button_click.
View 3 Replies
Jun 29, 2010
how to get the value of
<textarea id="textarea" style="width: 600px; height: 200px" >
View 12 Replies
Jul 30, 2010
I have the following html that I want to convert it to use asp.net web control
[Code]....
What will be the best approach? I thought about using asp:ImageButton, but it only has a PostBackUrl, sounds like it does a http post to default.aspx, but the html simply do a http get to default.aspx .
View 3 Replies