.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

Serializing a simple class as a single node, not a sub node!

Posted By:      Posted Date: October 04, 2010    Points: 0   Category :.NET Framework

While I have not bothered about this earlier I am going to need to get this sorted asap now that we are building a large Persisted (File System Based) Data Store.

The code below as it is will output this XML File contents

<?xml version="1.0"?>
<SimpleSerializationObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

View Complete Post

More Related Resource Links

How to display TreeViewItems different ways based on the item type under a single node?

Hi, I am having trouble trying to display hiearchical data under each node in two different ways depending on the data.  I hope someone will be able to provide me some help on this since I am rather new to WPF development. Maybe I am going about this all wrong but for now, I am trying to create a customized TreeView to represent data similar to the xml I provided in the code below.  The <ItemsPresenter/> instances listed in the code are not exactly doing what I need.  I will probably need to filter the content that I list with each of the two <ItemsPresenter/> tags based on the type of each item although I have no idea if this is possible.   <Window x:Class="Wpf_treeview_testing.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <!-- * The "xmlData" describe roughly the type of data that I require visual representaion of. * Since I could not find a WPF Control that will present a Hierachical Data Template close to what we need, I am trying to setup a TreeView to represent this information by using a ControlTemplate for TreeViewItem. * The preferred result is to present different items types in

Retrieving A Single Node Anywhere In An XML string


I have an XML string containing a Node named Code. I try to obtain the node using the following code:

XmlDocument doc = new XmlDocument();

doc.LoadXml("<Message version="1.5" xmlns="http://www.testingxml.com/messaging"><Header><To>mailto:EMEDSL.dp@testingxml.com</To><From>mailto:SDEDIR.dp@testingxml.com</From><MessageID>0</MessageID><RelatesToMessageID>634223224036548000</RelatesToMessageID><SentTime>2010-10-10T19:46:35.9Z</SentTime></Header><Body><Error><Code>900</Code><DescriptionCode>902</DescriptionCode><Description>HRA must be populated with valid data only.</Description></Error></Body></Message>");

XmlElement xe = doc.DocumentElement;

XmlNode xmlnode1 = xe.SelectSingleNode("//Code");

xmlNode1 is always null.

Any h

Getting a Single node, in linq results to:


A part of my rawXML i get from a webservice:

<GetOpties>\n  <Table>\n    <nOptieLijstIDHist>167613</nOptieLijstIDHist>\n    <Code>W01</Code>\n    <Omschrijving>ADVANCE PAKKET</Omschrijving>\n    <Prijs>1990</Prijs>\n    <Bijzonderheden>Lichtmetalen velgen Porto 7J x 17\" met 22545 R17 banden + 15 mm verlaagd onderstel + straffe demping en versterkte vering + 35% getint glas achter</Bijzonderheden>........ 

I try to get the the values in a linq query:

var query = from feed in xml.DocumentElement.ChildNodes.Cast<XmlNode>()
                            select new AutoDiskClass.Options
                                nOptieLijstIDHistField = feed.SelectSingleNode("nOptieLijstIDHist").InnerText,

single node SQL server 2008 R2 failover cluster is down

I install a single node SQL server 2008 R2 failover cluster (server 1) and add a node (server 2) on other server . Now , the first sql server (server 1) is down , server 2 still up so i have 1 server running When i install a new single node sql server cluster on a new server two error occur (failed) : - Microsoft Cluster service (MSCS) cluster verification errors. -Cluster shared disk available check Or can i change the server 2 to the single node sql server clutser to add new node ?

SQL 2008 Single Node cluster installation fails on Windows 2008


SQL Server 2008 Enterprise Edition 64 Bit
Windows 2008 64 Bit SP2

SQL installation failed with this error message:

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. Reason: Token-based server access validation failed with an infrastructure error

Please let me know what the issue is.

I found 2 solutions in net:

1. Add new registry key named DisableLoopbackcheck under "HKLM\SYSTEM\CurrentControlSet\Control\Lsa\" and set to value 1

2. Set server principal name

Creating a Simple Class in C#

The second article in the C# Object-Oriented Programming tutorial describes how classes are created in C# and how behaviour, in the form of publicly visible and private, hidden methods can be added. This demonstrates some of the uses of encapsulation

Display homepage node along with child nodes


If the first Sitemap node is your homepage/default and all other nodes are supposed to be children / grandchildren of the first sitemap node in a web.sitemap, how do I set up my web.sitemap to enable me to display my cssFriendlyMenu with the homepage node along with the nodes that are 1 level down from it at the same time as in :

Home   Products   Services   About us


...or is it not possible to have the first sitemap node displayed along with the nodes that are 1 level down from it?  Do I need to have a different starting node rather than my homepage node?

ImageURL SiteMap Node


Hi Can anyone tell me how i can add the ImageURL from a sitemap into a navigation menu, i had this working with webforms but cannot get it to work with mcv

var sbMenuHelper = new StringBuilder();

sbMenuHelper.Append("<ul class='cssMenu'>");

var topLevelNodes = SiteMap.RootNode.ChildNodes;
foreach (SiteMapNode node in topLevelNodes)
    if (SiteMap.CurrentNode == node)
        sbMenuHelper.AppendFormat("<a href='{0}'>{1}</a>", node.Url, helper.Encode(node.Title));

return sbMenuHelper.ToString();

        description="Contact Us"

Addressing a specific node with CSS Friendly Control Adapters


Hello everybody,

I like the concept of the friendly control adapters, but I'm not sure if I can use them for my purpose.
My whole menu basically consist of one image, which itself contains the images for each menu item (is that understandable?).

Each menu item then displays only a certain part of the image.
I do this by shifting the background-position.

#navigation li#home a{
background-position:0px 0px;

/* Registration */
#navigation li#registration a:link, li#registration a:visited {
background-position:-106px -34px;

#navigation li#registration a:hover, li#registration a:focus {
background-position:-106px 0px;

/* Administration */
#navigation li#administration a:link, li#administration a:visited{
background-position:-212px -34px;

#navigation li#administration a:hover, li#administration a:focus{
background-position:-212px 0px;


I would like to do the same now with CSS Friendly, but I don't see how I can address each individual menu item node.
In static HTML I can give each link an ID (i.e. #administration), but I don't see how to do this with the asp:Menu control and CSS Friendly.

Can someone help me?

Thanks a lot,

(Imperfect) Solution to TreeView Postback / Client-Side Node Selection Issue


I've seen this question posted on all corners of the web... "How do I disable "AutoPostBack" on the ASP.NET 2.0 TreeView control?!"  Unfortunately, most of the answers either don't work, miss the point (don't work right), or boil down to "You can't do it."  I happen to know that this behavior worked perfectly in the IEWebControls TreeView that Microsoft released as an add-on prior to ASP.NET 2.0, however.  So I set out to find a solution for the ASP.NET 2.0 TreeView issue.

In a nutshell, the behavior that I and others are looking for is to have a TreeView rendered in a page that allows the user to expand, contract, and select nodes within the TreeView without causing a PostBack to the server.  This implies two things: (1) the most recently-selected node should be recorded as the currently-selected node [i.e., at PostBack time, the most-recently selected node is actually represented as the SelectedNode]; and (2) the selected node should exhibit the SelectedNodeStyle as specified in the TreeView declaration.

It appears that the TreeView engineers saw only two possible outcomes from selecting a leaf node in a tree: (1) immediately posting back to the server, or (2) immediately navigating to another web page.  They apparently did not consider option (3) just allowing selection in-place on the client, while waiting for a click on so

Node probability distibution - values don't sum to 1?

Hi, I am using sequence clustering algorithm and I have checked Node probability distribution (state transition) for one of the cluster. Probability values don't sum to 1. Why? I think they should. Do I miss something?

FAQ: How do I use the SerialPort Class for simple serial communications?

How do I use the SerialPort Class for simple serial communications?Please remember to mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.

LinQ to check if xml node exists in the XML??

Using LinQ or any C# syntax, I just want to know whether "Item" Child exists or not if the parent Node (ChildMenuSelected>>MenuSelected) are true from the below xml format.Xml Format:<MenuDataResult> <Items> <Item> <ItemType>Submenu</ItemType> <ItemTitle>Level22</ItemTitle> <Menu> <MenuSelected>false</MenuSelected> <ChildMenuSelected>false</ChildMenuSelected> </Menu> </Item> <Item> <ItemType>Submenu</ItemType> <ItemTitle>Level21</ItemTitle> <Menu> <MenuSelected>false</MenuSelected> <!--if ChildMenuSelected = true --> <ChildMenuSelected>true</ChildMenuSelected> <Item> <ItemType>Submenu</ItemType> <ItemSubType>0</ItemSubType> <Menu> <!--if MenuSelected = true --> <MenuSelected>true</MenuSelected> <ChildMenuSelected>false</ChildMenuSelected> <!-- whether this below item exists or not --> <Item> <ItemType>Submenu</ItemType> <Menu> <MenuSelected>false</MenuSelected> <ChildMenuSelected

MOSS Site with Basic Authentication and variations does not work on one node

Hi, We have one MOSS Farm with two nodes, on this we have several sites. For one specific site we have Basic Authentication and variations enabled in it, on one node site works fine. When we browse it pops-up for credentials and once credentials are provided it works fine and properly redirect to source variation home page. But on the other node when we browse the site it pops-up asking for credentials then after providing correct credentials it again asks for credentials twice and then it throws the following error : Access denied.   You do not have permission to perform this action or access this resource. And if we directly put the source site homepage url it throws following error: 401 UNAUTHORIZED We have checked the Alternate Access Mappings for the site and it is perfectly fine, if i enable windows authentication on the defected node the site works fine. This issue is just like pain in the neck still no resolution, please help us to resolve this issue. Regards, Jasjeet Singh

How can i update treeview root node every time based on the record entries

Hi all, I will have an mdi form and with a treeview which has it's initial property as visible =false. If i select an option from menu a child form will exists i will fill some details and click on save when ever click on save i will make the root node of the treeview to some name as File[batch count:0]. Now if i select another option from menu another form will appear and if i fill it with some details and click on save i would like to change the root node name to File[batch count:1] and a child node should exists with some name

On escape key while editing a treeview node

On hitting escape key while editing a treeview i would like to cancel the editing a would like to show the default name that was previously there. Where should i handle this can any one tell me please..    
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