A rough layout of my ASP.NET site is as follows
The main navigation currently relies on url query parameters (i.e <a href="/?category=InStock">) to determine what charting control is dynamically loaded.
I would like to improve on this design by adding an UpdatePanel to this design and having the panels update the chart / graph when a new category is selected. Since the anchor tags trigger a Page.Redirect when clicked I'm wondering if this can still be done with update panels or if I will have to modify my navigation <a href> tags to be Button controls?
The main reason we decided to go with <a href> tags was for the ability to bookmark a site and save the state of the page so the user return to that specific chart when needed.
What you could do is change your <a href> tags to button or linkbutton controls, ditch your current querystring driven logic, and just change the graph based on which button was clicked instead.
You could then add your update panel(s), enable browser history management in your ScriptManager and create history points when each button is clicked.
See this msdn article for details: https://msdn.microsoft.com/en-us/library/cc488548.aspx
What this does is inject the current page information in the browser's history and encodes the state that you specify in the querystring automatically.
This means the user can bookmark the current state of the page and everything is still AJAX'd.
Another good article covering the ASP.NET AJAX History feature:
https://web.archive.org/web/20211020103240/https://www.4guysfromrolla.com/articles/100808-1.aspx
Related
We have a bunch of modal dialogs in our application. When a user clicks a button it fetches the modal content from the server and displays it to the user. The way that it is structured, in order to fetch the content from the server, the button is nested inside of a form tag with an action specifying the URL to fetch the modal from. Because we can't nest form tags, this severely limits where we can place modal toggles without doing a lot of CSS trickery.
So, I'm wondering if it is acceptable from an accessibility standpoint to use an anchor tag with a valid href to display the modal. We'll intercept the click with JavaScript, fetch the content via ajax, and display it on the modal. If JavaScript isn't working or the user opens the link in a new tab, they'll still see the modal content, just with a sparse layout.
Is this a reasonable and accessible approach to take? It seems like as long as the anchor has a valid href it should be fine, and provides a tiny bit more flexibility to the user if they want to open up the link in a new tab.
I have setup DFP to return a list of Custom Creatives. Each of these creavtives contains the following HTML:
<a href='%%CLICK_URL_UNESC%%' class='drop-down-ad'>Ad Link Text</a>
When these creatives are rendered to the page I have some JavaScript that finds all the anchor tags containing the class drop-down-ad and grabs the src attribute and stops the page from changing when clicked and loads content in via ajax. I do not want the page to change but I would like to still tell DFP that the user click the link. I am not sure if this functionality is supported by DFP?
Is making a request to the generated CLICK_URL_UNESC using ajax supported by DFP? Or is this not a thing I should be doing.
Hopefully I have explained what I am trying to do ok. Let me know if you have any questions.
I come from PHP side, but I'm in need to develop a site using ASP .NET
So far I manage to create a master page. Now I'm dealing with menus and submenus
What I'm trying to do is, if the user picks "About Us" from the main menu, under the about us page I want to display a submenu with the options "who we are, what we do, contact us"
If the user picks "Our Products" from the main menu, then under the products page I want to display a submenu with the options "product 1, product 2, product 3"
Is this possible with only one master page?
I read something about menu control but not sure that is what I need. So far I found how to display a sitemap, but not specific sections of a sitemap, if this is the way to do things.
Any links, sample code, point of reference will be appreciated.
Thanks
One approach I'd look at is using JavaScript to display the selected menu items without a postback.
I'd need more information on how your main menu is hooked up though.
You should probably write a separate web User Control to handle the menu and just include it in your Master page as usual.
A simple way is to use a Placeholder control in side which you write the markup for each menu set you want to include. Set their Visible property to false in the markup (.ascx file).
<asp:Placeholder runat='server' id='phAbout' Visible='false'>
<a href='/about/index.aspx'>Information about Us</a>
<a href='/about/us.aspx'>About Us</a>
</asp:Placeholder />
Then, at Page_Load time, do some processing, for exampl examine the Request.Path property to work out what sub-directory the current page is in etc. Then run a bit of logic to show the relevant menus by setting the associated Placeholder's Visible property to true.
It looks like each of your main menu item contains a group of pages.
Create a sitemap file to describe the whole site and all menus. And while each page is loading, site map gives you the current node from the map, which is the current page.
You can easily construct the submenus by walking through the nodes in any page/master page.
I have an ascx component, that holds two-level menu, because there are several user types, and the menu needs to be computed on server.
Anyways - I'm also doing the highlighting of current menu item on server (adding a selected class/css to an item). Highlighting with javascript is not good option, because there is content in datagrids, that causes postback and needs to remain the menu in the same position as selected value is.
So I am doing this as some kind of mapping with a hashtable (e.g. pairs (url-of-the-site, menu-item-to-highlight)), and i have to include a mapping for every site my web application contains in order i want to have menus highlighted... so somehow it bothers me that there has to be a better way to do this. are there any better techniques?
A technique I use on my master page/content pages with .NET 2.0 is to have a publicly accessible method called "SetNavigation" that takes a string character that correlates to the hyperlink control I want to highlight. What the method does is set the CSS stylesheet of the specified hyperlink to my "selected" one.
Then in my child pages, in the Page_Load method, I call the SetNavigation method and pass in the link based on the current page I'm on, such as SetNavigation("hypSearch")
I would gather that you could create a similar control on your ASCX control and then have your Page_Load events, or even button click events call the method if so desired.
I have a page which is used to display numerous forms for the user to fill out and get reports generated. Each of these forms is inside it's own ASP:Panel control so that I can toggle the visibility of the form (so that only those with appropriate permissions get access to the reports they are allowed to).
The client has now requested a "table of contents" like area on the page with hyperlinks pointing to each of the forms (so that they don't have to spend time scrolling the page to find the particular report form they want). This is easy to accomplish using standard <a href="#Area"> and <a id="Area"> tags. What I am now looking for is a way that would allow me to hide the links of reports that the user does not have access to.
I was first thinking of using the ASP:LinkButton control, but I do not want any postbacks to occur from clicking the links (that would be very unnecessary). Are there any other methods I could use to accomplish the same goal? I am looking for something which would make it easy for me to toggle the visibility of the corresponding link at the same time I am toggling the visibility of the panels containing the report forms (done now from the code-behind).
Note: Using VB as the language
If you use link controls you can just show or hide the link bases on the visibility of its related panel.
Link1.Visible = Panel1.Visible
I was first thinking of using the ASP:LinkButton control, but I do not want any postbacks to occur from clicking the links (that would be very unnecessary)
I disagree. You're talking about redrawing most of the page each time a link is clicked, making a full postback appropriate from a technical standpoint. Additionally, users are conditioned to expect a round-trip to the server when they click on links. That's what a hyperlink normally does. So it's also appropriate from a user-experience standpoint.