Need assistance with DSO

A

AMDRIT

Hi gang, this is pretty critical to me. Any help you can provide is
appreciated.

I have a WebBrowser control placed on a form. I am not getting the same
results as I am in IE.

Here is the deal, I dynamically load the HTML into the WebBrowser control,
then I invoke a script that passes in XML data to the document. The XML
data is not that large, say if it were recipies, it would have maybe 4
recipies in it.

The script that loads our "recipies" first populates the master DSO for safe
keeping. Then it loads the first "recipie" in the the working DSO so that
the user may view it.

What is not working properly is that the data never displays in the
WebBrowser control on the WinForms application, in IE, it works just fine.
I have explored using the onreadystatechange() and ondatasetcomplete()
events in attempt to determine what is going on. I have also traced the
data being sent to the working dso, it just never appears to load the data
in the WebBrowser control.

The WebBrowser control is intended to be a read only view of the data on the
system.

I populate the HTML on the control via the controls DocumentText property
Me.wbViewer.DocumentText = My.Settings.HTMLFile

I then wait for the document to complete loading
Private Sub wbViewer_DocumentCompleted(ByVal sender As Object, ByVal e As
System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles
wbViewer.DocumentCompleted

I then set the data for the document via InvokeScript()
If (Not (wbViewer.Document Is Nothing)) Then
Dim ObjArr(0) As Object
ObjArr(0) = CObj(XmlWrapper.MakeXMLData(<mybusinessobject>))
Me.wbViewer.Document.InvokeScript("loaddata", ObjArr)
End If

Inside the html I have something like:

<!-- Menu Section -->
<div class="left" id="menusection"></div>

<!-- Data Table-->
<table datasrc="#mySelectedData" id="DataTable">
<thead>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</thead>
<tr>
<td><span datafld="Column1"></span></td>
<td><span datafld="Column2"></span></td>
<td><span datafld="Column3"></span></td>
</tr>
</table>

<!-- Error Reporting Textbox -->
<div id="myErrors" />

<xml id="myData"></xml>
<xml id="mySelectedData"></xml>

<script>
function loaddata(data){
try {
myData.XMLDocument.async="false";
myData.XMLDocument.loadXML(data);
reload(0);
}
catch (e) {
myErrors.innerText += "Error loading data: " + e.description;
}
}

function reload(index,settrans){
try {
//Populate transaction table if requested
if (settrans!=0){loadtransactions();}

//hide the data table, just incase the data is empty
DataTable.style.display="none";
DataTable.style.visibility="hidden";

var oNodeList = myData.XMLDocument.selectNodes("rootNode/item");
var oTempNode = null;
var iIndex=-1;

oTempNode = oNodeList.nextNode;

while ( oTempNode != null ){
iIndex ++
if (iIndex == index){

//Load subset of data into working DSO
mySelectedData.XMLDocument.loadXML("<rootNode>" + oTempNode.xml +
"</rootNode>");

//Generate context menus for this set data
genmenus();

//Display the data table
DataTable.style.display="";
DataTable.style.visibility="visible";

//We've gotten what we came for, move on
break;

} //If (iIndex == index)
} //While ( oTempNode != null )
} //try
catch(e){
}
}
//loaddata('<sample><xml><string><here>');
</script>
 
A

AMDRIT

I have a workaround, it is not elegant, but it works. Before I set the html
text, I replace the %ReplaceMe% with the desired xml. I do not have to
invoke the loaddata script anymore. I do have to reload the HTML everytime
I want to change the XML data.

WinForms
Me.wbViewer.DocumentText =
My.Settings.HTMLFile.replace("%ReplaceMe%",XmlWrapper.MakeXMLData(<mybusinessobject>))

HTML
<xml id="myData">%ReplaceMe%</xml>
 

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

Top