Click here to Skip to main content
15,900,110 members
Home / Discussions / C#
   

C#

 
GeneralRe: Why is my Sidebar not in the right place?? Pin
blacktech15-Jul-15 2:39
blacktech15-Jul-15 2:39 
QuestionSaving an array to disk Pin
Member 1171394212-Jul-15 5:57
Member 1171394212-Jul-15 5:57 
AnswerRe: Saving an array to disk PinPopular
OriginalGriff12-Jul-15 5:59
mveOriginalGriff12-Jul-15 5:59 
GeneralRe: Saving an array to disk Pin
Member 1171394212-Jul-15 6:05
Member 1171394212-Jul-15 6:05 
QuestionHow to update database when adding an item Pin
Member 1183153312-Jul-15 5:15
Member 1183153312-Jul-15 5:15 
AnswerRe: How to update database when adding an item Pin
OriginalGriff12-Jul-15 5:46
mveOriginalGriff12-Jul-15 5:46 
GeneralRe: How to update database when adding an item Pin
Member 1183153312-Jul-15 5:53
Member 1183153312-Jul-15 5:53 
AnswerRe: How to update database when adding an item Pin
Dave Kreskowiak12-Jul-15 6:26
mveDave Kreskowiak12-Jul-15 6:26 
GeneralRe: How to update database when adding an item Pin
Member 1183153312-Jul-15 7:00
Member 1183153312-Jul-15 7:00 
QuestionLinq-ToSql and EF Questions Pin
Kevin Marois10-Jul-15 4:54
professionalKevin Marois10-Jul-15 4:54 
AnswerRe: Linq-ToSql and EF Questions Pin
Richard Deeming10-Jul-15 5:54
mveRichard Deeming10-Jul-15 5:54 
GeneralRe: Linq-ToSql and EF Questions Pin
Kevin Marois10-Jul-15 5:56
professionalKevin Marois10-Jul-15 5:56 
Questionwifi form Pin
Member 118239158-Jul-15 16:51
Member 118239158-Jul-15 16:51 
AnswerRe: wifi form Pin
Dave Kreskowiak8-Jul-15 17:22
mveDave Kreskowiak8-Jul-15 17:22 
QuestionCasting HttpRequestMessage.Properties["MS_RequestContext"] to OwinHttpRequestContext Pin
Alaric_8-Jul-15 11:09
professionalAlaric_8-Jul-15 11:09 
QuestionSelectSingleNode issue Pin
tiwal7-Jul-15 7:42
tiwal7-Jul-15 7:42 
I have a very basic xml document :

<language>
  <main>
    <aboutlink>About</aboutlink>
    <registrationlink>Registration</registrationlink>
    <loginlink>Enter</loginlink>
  </main>
  <about>
    <description>This site is about friends and games </description>
  </about>
</language>


I just want to grab the innerText of the <aboutlink>, <registrationlink> and <loginlink> nodes and assign them to three different Hyperlinks in a web page . So here is what I do (assuming fPath contains the path to this xml ile) :

LanguageDoc.Load(fPath);
XmlNode root = LanguageDoc.DocumentElement;
main = root.SelectSingleNode("/language/main");
HyperLinkAbout.Text = main.SelectSingleNode("aboutlink").InnerText;
HyperLinkRegistration.Text = main.SelectSingleNode("registrationlink").InnerText;
HyperLinkLogin.Text = main.SelectSingleNode("loginlink").InnerText;



What's happening is that after the first call to main.SelectSingleNode ("aboutlink").InnerText (which is successful and gives me the right value to assign to the first hyperlink), the second call returns a null object, so the call to the InnetText method fails and I get an exception.
The element searched for exists in the xml, and I think the XPath path to that element is correct.
So, what's happening ?
QuestionRe: SelectSingleNode issue Pin
ZurdoDev7-Jul-15 7:50
professionalZurdoDev7-Jul-15 7:50 
AnswerRe: SelectSingleNode issue Pin
tiwal7-Jul-15 8:25
tiwal7-Jul-15 8:25 
AnswerRe: SelectSingleNode issue Pin
Richard Deeming7-Jul-15 8:36
mveRichard Deeming7-Jul-15 8:36 
GeneralRe: SelectSingleNode issue Pin
tiwal7-Jul-15 9:08
tiwal7-Jul-15 9:08 
GeneralRe: SelectSingleNode issue Pin
Dave Kreskowiak7-Jul-15 9:12
mveDave Kreskowiak7-Jul-15 9:12 
GeneralRe: SelectSingleNode issue Pin
tiwal7-Jul-15 9:40
tiwal7-Jul-15 9:40 
GeneralRe: SelectSingleNode issue Pin
Dave Kreskowiak7-Jul-15 10:02
mveDave Kreskowiak7-Jul-15 10:02 
GeneralRe: SelectSingleNode issue Pin
tiwal7-Jul-15 10:07
tiwal7-Jul-15 10:07 
GeneralRe: SelectSingleNode issue Pin
Richard Deeming7-Jul-15 10:10
mveRichard Deeming7-Jul-15 10:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.