FIX: Cannot Add Items to a Page from Server-Bound DhDocumentID: Q195174
|
A server-side implementation of code behind HTML may be unable to add items to the page it is bound to. If there are no calls to the add() method before a call to setBoundElements(), all subsequent calls to add() will not work.
Place a call to add(new DhText("")) in initForm() before calling setBoundElements().
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article.This bug was corrected in Visual Studio 6.0 Service Pack 3.
For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:
Q194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why
Q194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed
import com.ms.wfc.html.*;
import com.ms.wfc.core.*;
import com.ms.wfc.ui.*;
public class Class1 extends DhDocument
{
private DhTable table;
public Class1()
{
this.initForm();
}
public DhElement onElementServerBound(DhElement e)
{
this.add(new DhText("Work-around enabled!"));
return super.onElementServerBound(e);
}
protected void initForm()
{
// bind to the table
table = new DhTable();
table.setBindID("tableData");
// Set its background to red
table.setBackColor(Color.RED);
//--> the following line is the workaround
//this.add(new DhText(""));
this.setBoundElements(new DhElement[]{table});
}
}
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<P>
The table below should have a red background and some text below it that
is coming from Java code.</P>
<P>
<TABLE border=1 cellPadding=1 cellSpacing=1 id=tableData width=75%>
<TR>
<TD>text1</TD>
<TD>text2</TD>
<TD>text3</TD></TR>
<TR>
<TD>text4</TD>
<TD>text5</TD>
<TD>text6</TD></TR>
<TR>
<TD>text7</TD>
<TD>text8</TD>
<TD>text9</TD></TR></TABLE></P>
</BODY>
</HTML>
Page2.asp
<%
Set Module = Server.CreateObject("DhModule")
Module.setCodeClass("Class1")
Module.setHTMLDocument("Page1.htm")
%>
net stop w3svc /y
net stop iisadmin /y
net stop msdtc
mtxstop
net start w3svc
For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java,
please see the following pages on the Microsoft Technical Support site:
http://support.microsoft.com/support/visualj/
http://support.microsoft.com/support/java/
© Microsoft Corporation 1998, All Rights Reserved.
Contributions by Robert LaCasse, Microsoft Corporation
Additional query words: WFC HTML DhTable Java data Table null
Keywords : kbservicepack kbASP kbVJ600bug kbVS600sp2 kbVS600SP1 kbVS600sp3fix
Version : WINDOWS:3.1,6.0
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: May 19, 1999