Hi all,
I am developing a webcontrol and I am also developing an AjaxExtender for these control...
Now the problem is when I register an click Event, I works fine, but I would like to replace the
value of one special cell with the result I get from Sys.Net.WebServiceProxy.invoke(),
since I am not so familiar with javaScript and all these Ajax stuff ;) I would like
to ask you guys if you have any advice for me to do that...
thanks in advance,
Omid
It depends a bit on your table structure and how you have things marked up with id's and so on. The easiest possible case is that your TD has a unique id, in which case you can easily say:
$get('idoftheelement').innerHTML = resultsOfTheInvoke;
if you don't have a unique id for it, it's somewhat more complex, but generally it's easiest if you use array notation, for example,
var table = $get('idOfthetable');
var rows = table.getElementsByTagName('TR");
var firstRow = rows[0];
var firstRowTds = firstRow.getElementsByTagName("TD");
var lastTd = firstRowTds[firstRowTds.length-1];
once you have the TD you want, you can set its innerHTML property to the texto f the result param.
hi Paul,
thank you very much for the advice...
My Table and rows and Cols have all an unique ID,
so I think $get('idoftheelement').innerHTML = resultsOfTheInvoke; fits to me...
redards Omid.
ps. I have another little question... what will happen if the ID is not Unique?? will I get an Array?
ID's have to be unique. I've honestly never tried to do them otherwise, since the spec requires them to be. I imagine you'd get different results in different browsers and depending on your doctype declaration.
one thing to watch out for when using the Id is that if your table is a server control and its inside a Master page or a User Control, then ASP.Net will munge the server-side ID to keep it unique (in case you have mulitple instances of the same control o nthe page, etc). The solution to that is to either not use the id (use some other means such as the one described) or else embed the server-generated id somewhere on the page inside a <script> block such as : var myTableId = '<%= tblMain.ClientID %>';
No comments:
Post a Comment