EDN Admin
Well-known member
Hi.
I am writing an ASP.net page to view certain alerts from our SCOM implementation.
I have written a simple view which gives me the information that I need, however one of the fields contains a string representation of XML (dbo.AlertView.AlertParams) which (I presume) are enumerated and the values pushed into the placeholders of dbo.AlertView.AlertStringDescription.
now I can enumerate the xml in the field, but I do not know how many child elements there will be, so how can I correctly format the AlertStringDescription with the AlertParams values?
I was thinking something along the lines of:
<div style="background-color:white; color:black
<pre><span style="color:blue string AlertStringDescription = dr[1].ToString();
int nodeCount = 0; // xmlParams.FirstChild.ChildNodes.Count; [/code]
<pre>foreach (XmlNode xnode in xmlParams.FirstChild.ChildNodes) [/code]
<pre>{ [/code]
<pre>AlertStringDescription = (AlertStringDescription.Replace("{" + nodeCount + "}", xnode.Value.ToUpper())); [/code]
<pre>Debug.Print(xnode.InnerXml.ToString()); [/code]
<pre>nodeCount += 1; [/code]
<pre>}[/code]
This however gives me a nullreferenceexception on nodeCount.
TIA..
View the full article
I am writing an ASP.net page to view certain alerts from our SCOM implementation.
I have written a simple view which gives me the information that I need, however one of the fields contains a string representation of XML (dbo.AlertView.AlertParams) which (I presume) are enumerated and the values pushed into the placeholders of dbo.AlertView.AlertStringDescription.
now I can enumerate the xml in the field, but I do not know how many child elements there will be, so how can I correctly format the AlertStringDescription with the AlertParams values?
I was thinking something along the lines of:
<div style="background-color:white; color:black
<pre><span style="color:blue string AlertStringDescription = dr[1].ToString();
int nodeCount = 0; // xmlParams.FirstChild.ChildNodes.Count; [/code]
<pre>foreach (XmlNode xnode in xmlParams.FirstChild.ChildNodes) [/code]
<pre>{ [/code]
<pre>AlertStringDescription = (AlertStringDescription.Replace("{" + nodeCount + "}", xnode.Value.ToUpper())); [/code]
<pre>Debug.Print(xnode.InnerXml.ToString()); [/code]
<pre>nodeCount += 1; [/code]
<pre>}[/code]
This however gives me a nullreferenceexception on nodeCount.
TIA..
View the full article