Error getting values from a table created dynamic!

R

renateves

My problem is that i have a xml file that is convert into a table (by
xsl) in a
aspx file, and in vb code i want to get and put some values to the
table. Is the code:


ASPX FILE
<Get the table with the values from the xml file>
.....
<asp:Xml id="myXml" DocumentSource="XMLCat.xml"
TransformSource="Perf.xsl" runat="server"></asp:xml>
.....


XSL File
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/xsl/transform'>
<xsl:template match="/">
<style>
.value { width:"25%";font-family:courier new; font-size:.8em;
white-space=pre;}
</style>
<table border="1" cellspacing="0" cellpadding="3" id="tablexml">
<tr>
<th>id</th>
<th>text</th>
</tr>
<xsl:for-each select='treenodes/treenode'>
<tr>
<td class="value"><em><xsl:value-of
select='@id'/></em></td>
<td class="value"><xsl:value-of select='@text'/></td>
</tr>
<xsl:for-each select='treenode'>
<tr>
<td class="value"><em><xsl:value-of
select='@id'/></em></td>
<td class="value"><xsl:value-of select='@text'/></td>
</tr>
</xsl:for-each>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>


VB FILE
.....
tc.Controls.Add(New LiteralControl(newID & "," & category))
tr.Cells.Add(tc)
tableXml.Rows.Add(tr)
.....

and the output error is:

Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.

Source Error:


Line 153: tc.Controls.Add(New LiteralControl(newID &
"," & category))
Line 154: tr.Cells.Add(tc)
Line 155: tableXml.Rows.Add(tr)
Line 156: Else


Source File: C:\Inetpub\DSL\Patrocinio.PT\PortalDSL\DesktopModules\FAQ\AskManag.aspx.vb
Line: 155

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an
object.]
ASPNetPortal.AskManag.insertNewNodIntoTable(String newID, String
category, String id) in
C:\Inetpub\DSL\Patrocinio.PT\PortalDSL\DesktopModules\FAQ\AskManag.aspx.vb:155
ASPNetPortal.AskManag.cmd_AddCategory_Click(Object sender,
EventArgs e) in C:\Inetpub\DSL\Patrocinio.PT\PortalDSL\DesktopModules\FAQ\AskManag.aspx.vb:64
System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()

Thanks for the help that can be give!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,077
Messages
2,570,567
Members
47,204
Latest member
abhinav72673

Latest Threads

Top