SiteMapPath Populated - c#

How on earth is this SiteMapPath1 being populated? I have checked everywhere. I don't expect an exact answer just some ideas how it could be getting populated.
Front end
Back end
After page is loaded
The issue I am having is the breadcrumb is displaying an extra node and I have no idea why only discrepancy between my page and all the others what is is inherited. I've checked the data base I've checked all related pages how would one find out where the SiteMapPath gets its hierarchy?
I just want the hierarchy to be correct for some reason my page shows it is a child of another page when it isn't. Maybe there is a way to hide the previous node on my page alone. Should be Home: Email Notifications not Home: Optimized Duty Schedule: Email Notifications. Any ideas would really help thanks.

From a comment by Albert D. Kallal:
there should be a file called Web.SiteMap - that's what drives the SiteMapPath control that is dropped into each page that you want that breadcrumb list. It is not maintained automatic, but maintained by you. So YOU have to maintain that Web.SiteMap, and put what pages you want into that file. You THEN drop a SiteMapPath control onto each form that you want that site map list.

Related

Standard Navigation Menu on all sub ASP.Net Pages

Hello I wanted a navigation menu for my website, and wanted to create it so that it will be shown on every webpage where I implement it. and when I change something on the navigation that it gets updated for all the other websites where I put the navigation on.
I have heared from a Master Page but I dont think that it will update all sites when I do a change on it.
It would be silly to create a menu and then copy paste it on the other 50 subpages or so.
Regards
I think Master Page is exactly what you are looking for. Just make sure that all of your other pages use that Master Page, and whenever you change it it will affect all the pages using it.

load an aspx page in an updatepanel

I'm developing a web template using asp.net and c#, which contains 3 parts. I handle the partial refreshing of the page with using updatepanel.
As you can see in picture below, the first parts is the top menu which is refreshed; the left sub menu, then the left sub menu refresh the middle panel(Details) and shows all the detail which contains a table with insert, delete, edit and paging buttons. I used a listview to develop the tables.
I have more than 50 modules similar to this which contain a table with some buttons, and if I put all the tables in the same page the page, the code would be very huge. That's why I came up with the idea to put each table in separate page and just load each page in the 3rd panel.
I have gone through the Uframe but I couldn't use it at my page properly.
I would really appreciate that anybody help me to overcome this problem, to load separate aspx page in 3rd panel, but without using iframe, or guide me how to use the uframe step by step. Or if you have another idea to get rid of this problem.
This is exactly the type of situation that Master Pages were intended for. Master pages allow you to define a consistent look for pages, with as much content as you like on the Master, and the parts that change in a "child" page (in the ContentTemplate)
Master Pages are documented here and there is an introduction to Master Pages video here.
Master pages can absolutely work with an UpdatePanel as well. This is documented specifically here.

How to display multiple pages under tabs similar to a Browser tab retaining loaded pages

We have an application where we have a single level navigation menu with some heavy-duty pages on each link. The user can switch back and forth between these pages frequently to obtain information that he needs.
Once the page gets generated, it wouldn't change for the session. However, the page is specific to the user, hence we cant cache it.
I was trying to come up with a solution where we generate the page once, and keep it hidden in the background until its link is clicked, but haven't been able to get my head around this.
One of the ways I thought was to have multiple div tags (one for each page) on one page and keep toggling the visibility as the links are pressed, but that would end up making this single page very heavy. Someone also suggested using iFrames, but I am not really comfortable using the iFrames much and I'm not even sure, if it would be any helpful either.
Can you guys please suggest a few approaches to tackle the issue?
update: Just to clarify, we are fine with keeping the pages separate and navigate across using a standard menu bar. We were just looking for ways to optimize the performance as we know that the pages once generated wouldn't change and there should be some way to tap that benefit.
You can use Ajax tab control for this purpose
Try taking a look at this MSDN article which specifically tackles the issue of how to user-level cache. Also, it might be more manageable to break each tab into a user control. That way your ASP.NET page has just the tab control and 1 user control for each section under the tab. It makes managing tabs much easier.
EDIT:
What I would do in your case, since you say the data won't change for the user, is I would grab the static data from the database and then I would store that data in the Session cache. THe session cache is specific per user and you can try to retrieve the static data from there instead of repetitively calling the database.
Check out the ASP Multiview control. Just remember that even though the different views are hidden when not active, their viewstate is still being sent back and forth. Can be a benefit if you need to check control values across views though.

ASP.NET Menu control changing position after postback

I am currently testing a menu in ASP.NET I've recently made using asp:menu control.
The menu is just as I want it to be right now, but whenever there is a postback that updates the whole page, it moves a little downwards (only once, a second postback won't move it a little bit more).
It's not CSS - > I've removed all CSS from this menu)
It's not any property -> I've commented out everything related to customizing the menu
It's not any other element above it enlarging -> I've specially put it inside a table, in which the only content is the asp:menu control
It moves a lot downwards in IE6, a little in IE8, and it doesn't move at all in Firefox 4.
What could I do ? Are there any alternatives ? Is there any property I can use, or any outer element I could put it inside in order for it to stay still ?
And yes, every single machine this is going to run in is using Internet Explorer. The nightmare of any web developer.
---[update]-----
I've built a menu in a separate project, and the effect wasn't there! I've copied the exact same files into my project, and ran it, and the issue was there.
Could it be a difference in the asp.net version ?
Did you check using IE web developer toolbar to see what's the html looks like in that area before and after the postback? It seems more like a browser issue so the toolbar would give you details as what is coming in the gap or may be what's pushing it down.
If the app is in asp.net 4.0, look at the source code of the page after it renders the first time, and then after the postback. Make sure it renders as divs on both or tables on both.
I currently have a similar issue where my menu "spreads out" on the postback. Before the postback, it renders divs. After the postback, it renders tables.
There is specifically a property on the menu "RenderingMode" which is suppose to control this, but it is not working for me.
I had the same problem. My navigation menu sits in an UpdatePanel, and I changed the UpdateMode from Always to Conditional - problem solved. This was in my master page.

Dynamically creating asp.net with c# pages

I am struggling with finding clear answers to dynamically creating the same page over and over. The questions and samples I have found seem to be all over the board on this topic. I have studied the life cycle and still seem to not have a clear answer as to where code should go.
I have a master page and a content page. All the content in the content area needs to be dynamically created (text boxes, ddl's, page tabs, buttons/onclick etc.).
After a user fills in data and clicks a submit button, I need to read the values off the form and rebuild the page completely again (not add/remove controls to current content).
My question is then.
Where do I put my code to build the page?
Will this area allow me to use IsPostBack so I can rebuild content with Request.Form values?
Will my buttons _Click events work?
Are there any working samples out there you could direct me to?
Thank you very much for the feedback...
I don't know all the answers to your questions, but I hope this may get you started. When dynamically generating the UI through code, this happens in Init. Controls dynamically loaded on Init is key because between init and load, on postback, viewstate is loaded for these controls.
This means you need, on every postback, recreate the page as is to match the previous control tree, then deconstruct it after init and recreate the new UI, if something is supposed to change UI wise. This is because it validates the tree structure to determine its the same UI. Now, if you don't need viewstate, this may not be as much of an issue. I haven't verified this without viewstate to see if it behaves different.
It depends how dynamic you need it, whether you need viewstate (is a big factor).
HTH.
Try creating the controls in the page's PreInit method. "IsPostBack" should work and the click event handlers should work as well.
What you need is a web user control, see ASP.NET User Controls
Brian's advices are good and you should follow them.
This might not really answer your question but still I add it as an advice. I'm professionally creating ASP.net web applications at quite a large scale and from my experience I can say that too much "dynamics" is usually bad and should be avoided because it just introduces complexity. Normally you might want to expose UI parts into ASP.net UserControls or if you want to make them even more reusable (if that's a factor) then into ASP.net Server controls. Then you replace different of them dynamically rather than creating everything from scratch.

Categories