Last post Sep 06, 2010 04:32 AM by Qin Dian Tang - MSFT
Sep 02, 2010 10:56 AM|asimnazir123|LINK
I am working with XMLdatasource and trying to consume a XML file. Now problem is there are scenarios when a link is not available in the xml file. Like in the e.g. below:
<a href='<%# XPath("link") %>'
say "link" can or cannot be there in the file. Now when "link" is missing, this expression throws exception. How can I handle this exception so that it continues loading page normally or can I check "link" existence somehow?
Sep 06, 2010 04:32 AM|Qin Dian Tang - MSFT|LINK
I am afraid XmlDataSource cannot handle it. You can return the xml data into XmlDocument or a DataTable, then check the node to see if it is null or not. If not null, then bind to GridView directly. If null, then add a temp value "null" to it.