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


Top 5 Contributors of the Month
david stephan
Santhakumar Munuswamy
Fauzul Azmi
Asad Ali
Post New Web Links

Change Xml Node Attribute

Posted By:      Posted Date: October 18, 2010    Points: 0   Category :ASP.Net
 

Hello all...

I am trying to change the attributes of a xml node in a smart device application (pda).

The first problem I have is that xmlDoc.SelectSingleNode("xpath"); does not work.

I found another way to select each time the node i need (xmlDoc.DocumentElement.ChildNodes.Item(currentPosition))

and now I need to change the values of the node's attributes.

I have done this for a web application before but does not work here and cannot figure out what to do...

this is the code I have...

                XmlElement newElement = xmlList.CreateElement("SUB");
                XmlAttribute nameAttribute = xmlList.CreateAttribute("Name");
                nameAttribute.Value = tbProductName.Text;
                newElement.SetAttributeNode(nameAttribute);
                XmlAttribute priceAttribute = xmlList.CreateAttribute("Price");
                priceAttribute.Value = tbProductPrice.Text;
                newElement.SetAttributeNode(priceAttribute);
                XmlAttribute offerAttribute = xmlList.CreateAttribute("Offer");
                offerAttribute.Value = tbProductOffer.Text;
                newElement.SetAttributeNode(offerAttribute);
                XmlAttribute offerPriceAttribute = xmlList.CreateAttribute("OfferPrice");
        


View Complete Post


More Related Resource Links

how to change dynamically [Bbrowsable] attribute for a property at design time c#

  
hi,   how to change dynamically  [Browsable] attribute for a property  at design time c#

Treeview - how to change node icon depending on node contents

  
I have a treeview in an MVVM application: <TreeView ItemsSource="{Binding RootNodes}"> <TreeView.ItemContainerStyle> <Style TargetType="{x:Type TreeViewItem}"> <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" /> <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" /> <Setter Property="FontWeight" Value="Normal" /> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="FontWeight" Value="Bold" /> </Trigger> </Style.Triggers> </Style> </TreeView.ItemContainerStyle> <TreeView.ItemTemplate> <HierarchicalDataTemplate ItemsSource="{Binding Children}"> <TextBlock Text="{Binding NodeName}" /> </HierarchicalDataTemplate> </TreeView.ItemTemplate> </TreeView> The treeview is bound to an ObservableCollection called RootNodes. Elements in the RootNodes collection expose a member "NodeName" which is the text for the nodes in the treeview at runtime. They also expose a member called "NodeType", effectively an enumeration that indicates what type of icon should be displa

Cluster Node Change

  

Hello Friends/Colleagues,

 

I have 2 nodes active/active with 3 virtual instances.

2 instances on node 1 and 3d instance on node 2.

 

Sometimes they automatically change from node 1 to node 2.

Is there any way that I get some notification regarding the instance that have changed from one node to another?

 

I found following may be probable solution:

EXEC master..xp_cmdshell 'cluster resource "SQL Server (Instance Name)"'

Result: Instance Name, Node Name

Put results into table..........Again run the command.....compare.......too much stuff.....

If someone knows the easy path to this.......

 

How could I get the information that has been changed?

 

Your help would be really great!

 

Thanks


clustered node change notification

  

Hello Friends,

 

I need a sql server script for my notification for the following.

I have node 1 and node 2 in my clustered environment.

 

Instances 1 and 2 usually runs on node 1. Instance 2 usually on node 2.

 

Sometimes they switch without notification. I need to know when they switch. Because I copy files from instances.

 

Need to know only what instance changed from which node and vice versa.

 

Any ideas and answers would be greatly appreciated.

 

Thanks


Node Change Notification

  

Hello Friends/Colleagues,

 

I have 2 nodes active/active with 3 virtual instances.

2 instances on node 1 and 3d instance on node 2.

 

Sometimes they automatically change from node 1 to node 2.

Is there any way that I get some notification regarding the instance that have changed from one node to another?

 

I found following may be probable solution:

EXEC master..xp_cmdshell 'cluster resource "SQL Server (Instance Name)"'

Result: Instance Name, Node Name

Put results into table..........Again run the command.....compare.......too much stuff.....

If someone knows the easy path to this.......

 

How could I get the information that has been changed?

 

Your help would be really great!

 

Thanks


treeview selected node font style does not change

  

Hi All,

I have a treeview and I am giving the node style in code behind.

Treeview design is as below:

<asp:TreeView ID="tvIARHierarchies" runat="server" NodeIndent="15" ShowExpandCollapse="true"
                                        ShowLines="True" Width="98%" OnSelectedNodeChanged="tvIARHierarchies_SelectedNodeChanged">
                                        <ParentNodeStyle Font-Bold="False" />
                                        <HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" />
                      &n

Xpath query to find an Node who's attribute contains a forward slash - Going crazy

  

If  I have a .XML file that contains the following example:

<Socks Style ="Business/Business Casual/Casual"

</Socks

When I try to use the Xpath expression below to find the element above by searching for the value contained in the Style Attribute, the expression returns null:

//Socks [@Style='Business/Business Casual/Casual'] 

I downloaded xPath virtualizer and I noticed that the expression above is adding the namespace alias when it finds the embedded forward slash contained in the value of the Style Attribute (which is of course not what I want to happen).  This is driving me up a tree!!  Isn't there a way to escape the forward slash?  I know it is the slash that is the problem because for testing purposes I substituted dashes (-) in one of the nodes' Style Attribute values and then changed the xpath expression to match and it returned the exact node.

My goal is to do some replacements on all elements with the Style attribute based on each contents but I can't even try that because of this roadblock.

Please help anyone

-Rick

 


Dynamically change UIHint attribute of Dynamic Control

  

Hi,

Can anyone tell me how I can dynamically change the UIHint of a Dynamic Control?  I have this script in the code-behind:

 

            DataClassesGripDataContext dc = new DataClassesGripDataContext();

            DynamicControlSponsor = (DynamicControl)FormView1.FindControl("DynamicControlSponsor");

            switch (SponsorType)
            {
                case AppConstants.SPONSORTYPEBUSINESS:
                   
                    DynamicControlSponsor.SetAttribute("UIHint", "Company");
                    break;

                case AppConstants.SPONSORTYPEINDIVIDUAL:
       

How to Localize Windows Forms and Change the Language at Runtime

  
Localization is the process of customizing your application to a particular language, culture or locale. Visual Studio provides support for localizing Windows Forms with much ease. In this article, we will see how to localize windows forms and give the user the ability to change to his preferred language at runtime.
When you run a localized application, the appearance is determined by two culture values. The UICulture property is used to specify which resource files will be loaded for the form. The Culture property, on the other hand, determines how strings such as dates, numerals, and currency amounts are formatted.
Let us see the steps required to create a localized form. You can then expand this example and adopt the same approach for the rest of the forms in your project

Selected to change the background color of the page

  

Hi,

As this site, http://www.borfin.com.tr/genel/Default.aspx, How can I change the background color selected pages.


Bug: Does not change column type from nvarchar to ntext

  

Scenario: If you create a table with a column of type nvarchar, populate it with some content and try to modify it using the WebMatrix editor, from nvarchar to ntext, it does not display any error message or warning that this is not possible. It silently saves and reverts the change, back to nvarchar. Wasted some hours on this issue as I thought my column was ntext, but in fact was still nvarchar.

Expected behavior: It should change to ntext, or if SQL CE doesn't support that, it should notify the user that no change was applied.


How to change the default page base class?

  

I've tried setting the <pages pageBaseType="DynamicWebPage" /> value in web.config, but when I response.write out the page type, I'm still getting Microsoft.WebPages.WebPage.

I'm simply trying to sub-class WebPage and add some additional functionality such as a dynamic PageData dictionary similar to Phil Haack's dynamic ViewData dictionary.

Thanks,

Adam


SqlDataSource how to change the stored procedures at run time

  

Hi

Is it possible to change the select, insert and update stored procedure of an SqlDataSource at run time. I don't mean to change the definition of the stored procedure, but I mean to change the assignment, i.e. To change the select stored procedure from "selectSP1" to "selectSP2" at run time. Is it possible?

Regards

Dimitris


I am not able to read xml file with XDocument if its Descendants has Attribute xmlns="http://abc.co

  

I am not able to read xml file with XDocument if its Descendants has  Attribute like:-

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<root>
  <row ID="1" xmlns="http://www.opentravela.org/OTA/2003/05">
    <var country_name="Caribbean and Rest of the world" city_name="Kingston" flight_category="Economy Class" via="Atlanta" flight_departure="London Heathrow" airline_logo="Delta" adult_fare="Delta" child_fare="660" infant_fare="561" date1="132" date2="2010-08-15" />
  </row>

</root>

I don't know what to do ?

Looking for some help..


Category attribute of user control property does not work correctly in categories tab.

  

Hi,

I have a User Control (ascx) and a property which a want to display in my categories tab in Visual Studio in the category named "Styles".

[Category("Styles"), DefaultValue(""), Description("The value for formating something.")]
public String MyFormatProperty
{
set { /* the code for set */; }
get { /* the code for get */; }
}

And here is the problem: Actually I do not need a get, because I only have to set the property (write only property). But when I omit the get, the property is displayed in the "Misc" category in the categories tab in Visual Studio. Only when I code the get as well, then the property is displayed correctly in the "Styles" category in the categories tab in Visual Studio.

Does anybody know why? How can I display the category correctly only with set?

Thanks, S.



Change Button Text in Multi Language Website

  

Hi i developing multi language website

using Master pages

everything fine

Page_Load i set the Text property of Button Control from Resource file

like this

Button1.Text = GetLocalResourceObject("Button1")

then in the button click event i cnage the text of the Button control

Button1.Text = GetLocalResourceObject("Button1_new")

but the text doesn't change and no error messgae

what is the problem how to solve this

 


How to change text in columns in SSRS?

  

I need to create a complex report and export it to Excel. 

In the first column header, text is displayed as "Hide Daily Columns", but I need the text to change as "Unhide Daily columns" when I click on it and when the text changes the columns under "daily" header (I have 3 columns under this header) present in the report shud be hidden and only weekly columns shud be visible. Any ideas please. I am new to SSRS and tried out many ways but didn't get it.


Categories: 
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