Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Binding problem

Status
Not open for further replies.

pankajv

Programmer
Jan 30, 2002
178
IN
We have a table, which uses data binding to generate the contents of the table. Initially there will be one blak row in the table, which is acheived by binding to a blank xml string(xml schema is same but no values). Later on when the user does something we get the actual xml string and uses it to repopulate the table contents. We have to perform some operations based on the data populated in tables i.e. some controls get generated and we need to access them. We are getiing object required error when we try to perform any operation on a control, which is changed because of the data binding. Things work if we put an alert just before performing any operation on the affected control

Here is the code which we are trying to use and getting an error. In this initially there is one row for control "Name" after databinding it should have 3 rows. So if we try to access the 2nd element we get an error. I have commented the alert and things doesn't work whereas it works if I uncomment the alert.

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<html>
<head>
<title>Test ASP</title>
</head>

<body>

<script language=&quot;JavaScript&quot;>

var strXML = &quot;<Results>&quot; +
&quot; <Record>&quot; +
&quot; <Name>Steve</Name>&quot; +
&quot; </Record>&quot; +
&quot; <Record>&quot; +
&quot; <Name>Mike</Name>&quot; +
&quot; </Record>&quot; +
&quot; <Record>&quot; +
&quot; <Name>John</Name>&quot; +
&quot; </Record>&quot; +
&quot;</Results>&quot;

function Test()
{
divDataIsland.innerHTML = '<XML id=xmlList>' + strXML + '</XML>';

tblList.datasrc = '';
tblList.datasrc = '#xmlList';
divDataIsland.style.display = 'block';
//alert(&quot;here&quot;);
document.frmTest.txtName(0).value=&quot;Ramesh&quot;

}
//-->
</script>
<form name=&quot;frmTest&quot; method=&quot;post&quot;>
<div id=&quot;divDataIsland&quot; class=&quot;DataIsland&quot;>
<xml id=&quot;xmlList&quot;>
</xml>
</div>
<br>
<table id=&quot;tblMain&quot; border=&quot;0&quot; width=&quot;20%&quot; cellpadding=&quot;0&quot;>
<tr>
<td width=&quot;25%&quot; valign=&quot;top&quot;><br>
<table border=&quot;1&quot;>
<tr>
<th width=&quot;20%&quot;>Name</th>
</tr>
</table>
<div id=&quot;divLocal&quot; scrolling=&quot;yes&quot; style=&quot;WIDTH:990px; HEIGHT:304px; DISPLAY: block;&quot;>
<table id=&quot;tblList&quot; name=&quot;tblList&quot; datasrc=&quot;#xmlList&quot; width=&quot;25%&quot; border=&quot;1&quot;>
<tr>
<td width=&quot;20%&quot;>
<input type=&quot;text&quot; id=&quot;txtName&quot; name=&quot;txtName&quot; datafld=&quot;Name&quot; size=&quot;13&quot; value=&quot;&quot;>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<br>
<table style=&quot;WIDTH:760px; HEIGHT:53px&quot;>
<tr>
<td colspan=&quot;2&quot;>
<input id=&quot;btnBind&quot; name=&quot;btnBind&quot; type=&quot;button&quot; value=&quot;Bind XML&quot;
onclick=&quot;Test();&quot;>
</td>
</tr>
</table>
</form>
</body>
</html>



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top