.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Changing title o sitemapnode at runtime from code behind c#

Posted By:      Posted Date: September 08, 2010    Points: 0   Category :ASP.Net
Hi guys ! I have a site map on my project and I have section which get values from sql database and it changes according to querystring Id value. In my sitemap the title of the page is everytime same. but I want tpo change it at runtime. I am using multiple sitemaps and My sitemap is not the default one. its name is rootSitemap. I tried some code which I got from msdn but it seems doesn't work for me; protected void Page_Load(object sender, EventArgs e) { SiteMap.SiteMapResolve += new SiteMapResolveEventHandler(this.ExpandForumPaths); } private SiteMapNode ExpandForumPaths(Object sender, SiteMapResolveEventArgs e) { // The current node represents a Post page in a bulletin board forum. // Clone the current node and all of its relevant parents. This // returns a site map node that a developer can then // walk, modifying each node.Url property in turn. // Since the cloned nodes are separate from the underlying // site navigation structure, the fixups that are made do not // effect the overall site navigation structure. SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true); SiteMapNode tempNode = currentNode; tempNode.Url = tempNode.Url + "?TransferType=" + Request.QueryString[0].ToString(); tempNode.Title = "My Transfer Desc - " + Request

View Complete Post

More Related Resource Links

Security in .NET: Enforce Code Access Rights with the Common Language Runtime


Component-based software is vulnerable to attack. Large numbers of DLLs that are not tightly controlled are at the heart of the problem. Code access security in the Common Language Runtime of the Microsoft .NET Framework addresses this common security hole. In this model, the CLR acts as the traffic cop to assemblies, keeping track of where they came from and what security restraints should be placed on them. Another way the .NET Framework addresses security is by providing preexisting classes which have built-in security. These are the classes that are invoked in .NET when performing risky operations such as reading and writing files, displaying dialog boxes, and so on. Of course, if a component calls unmanaged code, it can bypass code access security measures. This article covers these and other security issues.

Keith Brown

MSDN Magazine February 2001

Programmatically Changing the Profile Provider at Runtime


Dear All

I'm using one application but have multiple providers in my web.config for memberships, roles and profiles to allow my application to be used by different groups of users who need to connect to different databases.

This means I'm having to change the membership, role and profile providers on-the-fly in my code-behind files. So far I've taken care of the membership and roles a bit like this:

Dim RolePV As RoleProvider = Roles.Providers(GetSettingFromFile("Provider"))

However, I'm having trouble finding out how to do the same sort of thing for Profiles. I've looked at ProfileProvider and ProfileManager but I can't work it out how to access my the profile property that I've created in my web.config file called "ScreenSize". Normally you would just write Profile.ScreenSize to read or write to the property.

Please can you help me to understand how I access the profile property called ScreenSize by dynamically setting the profile provider first?

I'd be very grateful for any help or advice.

Many thanks



Can't Load 32-bit Com Object into managed code (C#) in runtime with 64-bit Enviroment

Hey everyoneI need your help with some 64-bit issues. I recently had to migrate my work to a 64-bit enviroment.  I'm using VS 2005.I have a simple c# application that is using an unmanaged c++ Com object. both are 32-bit applicationsBoth projects compile smoothly, and when i register my com object it succeeds. However, during runtime when i try to create an instance of the com class: 'someComClass a = new someComClass()' I get the error:COMException : Retrieving the COM class factory for component with CLSID {XXXXXXXXX} failed due to the following error: 80040154OK people, bring it on, what's wrong ? how do i fix it ? registery issues ? compiler issues ?Any help is welcomedWith thanksOded

Custom SharePoint Timer Job doesn't run after changing code and restart timer services.

Hi We are facing an issue that our custom SharePonit Timer Job doesn't run after a changing the code. First, we developed and deployed a timer job. It worked fine for a few days, then we detected a memory leak and killed the OWSTIMER.EXE. (Maybe we should uninstall the timer job and restart the timer services nicely). We fixed the problem, redeployed the fix as a feature (assemblies are re-GACed ...) to our small SharePoint farm (one web server, one services server), restarted the SharePonit Timer Services. Now we can see the time job in Timer Job Definition in Central Admin but the job never runs (Since it doesn't run, the timer job status page doesn't have any info about it). We tried the same process in a dev environment with SharePoint signle box installation. The timer job just works fine. I did some search on Internet and followed some instruction to clear the cache from "C:\ProgramData\Microsoft\SharePoint\Config\1d50d73c-9bf1-4444-85a9-910ed050d1bf" by 1. Remove all the xml2. Clear the cache.ini with "1".3. restart the timer services. It still doesn't fix the problem.Please advise what else I can do. I even rename the timer job and redeploy it. It doesn't help. I checked the even log and SharePoing log and couldn't see anything wrong. Our OS is W2K8.         public override void FeatureActivated(SPFeatureReceiverProperties properties)        { 

Changing the application title / name in the taskbar...

Hi all- I have a quick question....is there a way to change the name of my application within the window's taskbar?  Currently, on hover, it displays the name currently set as the Title of my application.  Is there a way that I can change this (a property on the Window object, etc) where I can maintain the window title, but have a different name for the taskbar?   Thanks for any help. Chris  

Changing case of all URLs in the website source code from Sentence to Lower

I only want to change case (Mixed to small) of URL in HREF attribute, nowhere else. This is just for convention purpose. eg changing   Its <a href="http://www.abc.com/S pecial-E dition.aspx">Special Ediation</a>.  View <a href="http://www.abc.com/O ther-N ews.aspx">Other News</a>.   to   Its <a href="http://www.abc.com/s pecial-e dition.aspx">Special Ediation</a>.  View <a href="http://www.abc.com/o ther-n ews.aspx">Other News</a>.

Changing Properties/Attributes of a Webpart in inline code block - Error 'System.Web.UI.WebControl

I'm trying this code below, but gettting error: System.Web.UI.WebControls.WebParts.WebPart' does not contain a definition for 'FilterValue1' I need to change the value of the FilterValue1 properties of a content Query WebPart with title = Applicant Files. Thanks in Advance!
protected override void OnLoad(EventArgs e) {  base.OnLoad(e); SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite SiteCollection = new SPSite("https://somesite/")) { SPWeb myWeb = SiteCollection.OpenWeb(); myWeb.AllowUnsafeUpdates = true; Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager mgr = null; mgr = myWeb.GetLimitedWebPartManager("default.aspx",System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared); foreach (System.Web.UI.WebControls.WebParts.WebPart myWebPart in mgr.WebParts) { if (myWebPart.Title == "Applicant Files") { myWebPart.FilterValue1 = "/13"; mgr.SaveChanges(myWebPart); break; } } } }); }

changing the content of website runtime

say i have a table in my website that contain <tr>  and <td> and "hello good morning" is wriiten over there. how can change the content of my website to "hello good night" on a click of button or using any other way of doing  this like yahoo and other popular website did.

Code behind file changing


I have a code behind file which has only a few placeholders and literal. The gridview control and others are added in real time according to program conditions. I noticed that once in a while th eprogram stopped working because the .aspx file is changed  and some of the place holders disappeared - Why? (the bolded lines disappeared once in a while)



<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DRProWebReport.aspx.cs" Inherits="DRProWeb.DRProWebReport" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

How do I keep SP 2010 from changing my HTML code? It is really ____ me off!!


Ok, I am trying to add simple html and css to a text box defined as "Enhanced rich text (Rich text with pictures, tables, and hyperlinks)"

But everytime I save and close SP changes the HTML. It is really starting to make me MAD. can I turn that "Feature" off? I am trying to add something as simple as this.

<hr noshade="true" width="1px" /> but SP keeps changing it to <hr width="1px" />


<div style="background-image:url('imgs/main_headr.jpg');"> </div>

but SP keeps removing the style all together.


I am experiencing this in CEWP's as well as pages.

changing Asp.net Gridview's cell from Label to edit mode in code behined file


 Hi all,

In my asp.net application i'm using gridview to which i'm binding data dynamically by writing a select query in code behined file (all column's are autogenerated) now i want to change gridview cell to edit mode from label to textbox or dropdown on clicking of gridview's cell.How can i achive this in code behined file.

thanks in advance

DataBinding not updating underlying business object when changing control property from code


I have a custom data form control that in code generates databindings between the selected custom business object (LLBL) and the various controls on the screen. Everything works in that I set the DataContext to the selected business object and the data appears in the GUI. If the user changes anything on screen, the data is getting updated into the business object.

However, now I have some custom logic that when the user presses a button I need to update some fields. Currently I'm setting this data directly into the controls, setting the new value into the property that is bound. However, the data is not getting pushed back into the business object.  I had this same issue building WinForm apps in that databinding only fired if the user was in the control and left it.

Does the same thing apply to WPF? How can I get ANY change on say a TextBox's Text property whether via user interaction or from C# code to push that value into the bound business object property?


Changing the address in app.config at runtime ..AN ISSUE..HELP neede..

hi wcf champs.,

hmm...I have a problem..and seriously need a solution to get things done well..!!

Have developed a wcf Upload application,the wcf service is hosted on IIS..now,the endpoint address at the server is exposed at client(in app.config).If further the server ip changes to some other..then the address at the client must be changed..!right..ya I did something to handle this but ,its another problem..!!.

Let me say what i have done and why does that give a problem..


*.*.The server ip is stored in a xml file.When the application runs,it picks up the server ip and changes it in Client.exe.config...

*.And if there is EndpointotFound exception at the client,it asks the admin to check the ip of the server.

*.The admin checks it and if the server ip is changed,the admin changes the ip in the xml file (where server ip is stored).

now let me know.."IS THIS A RIGHT APPROACH TO SOLVE MY PROBLEM" ..But then there is a problem!!let me share that with u..


*.The ip that is picked from  xml and placed in Client.exe.config.

Changing crid cell content at runtime


In a cell in a grid, I have a TreeView. When the parsing of the data behind the treeview yields an error, I would like to replace the treeview with a textblock with information on the error details.

I'm thinking about using a datatemplateselector, but I can't figure out how, or if this is the best approach. Any suggestions?

Alternatively I will place a ContentControl in the grid cell and populate it with the correct content from the code behind file, I just think there could be a more elegant solution in pure XAML.

Changing fonts at runtime


Is it possible to change a font at runtime? I am using reporting service to generate letters. Some letters use a different font (can based on a field value), but I don;t really want to use a separate report for each one.

Change Top Nav "Home" Link without changing site title?


Is it possible to change the top navigation bar "home" link (i.e. the selected top-left navigation item) without changing the site's title?

This is for a site configured with the Global Navigation set to: "Display the navigation items below the current site".

So, for example, if the site is called "Team Site", then the top-left navigation link will be called "Team Site". I would like to change the navigation link text, but keep the site title.

Changing a control attribute at runtime.


Hi Guys,

I'm basically trying to get a div containing a loading gif to show on my page at runtime. I call it from a button click event as well as in the code flow. It was working before I used the AJAX Update Panels. I've since taken them out as they were causing issues with RegisterClientScriptBlock. By the way, does commenting out the AJAX Markup like this...

<%--           <asp:UpdatePanel ID="up_search" runat="server">

...remove them from influence?
My div markup looks like this..
<div id="loading" style="visibility: hidden;" runat="server">
    <img id="loading_gif" alt="Loading..." class="loading" src="Images/panel_loading.gif" />

My code is initiated from the button click event.

    protected void btnSearch_Click(object sender, EventArgs e)

        //show the loading image

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend