Silvelight and AJAX


i trying make ajax call , set 'responsetext' textblock element 'txt'.

sl = document.getelementbyid("silverlightcontrol");
sl.content.findname("txt").text = xmlhttp.responsetext;

above code results in :- error: 'sl.content' null or not object

if put alert() statement between above 2 statements, code works fine.

tried substitute alert() settimeout() in function handleajaxcallback() below, page seems hang.


function handleajaxcallback() {
var flag;
if ((xmlhttp.readystate == 4) && (xmlhttp.status == 200)) {
sl = document.getelementbyid("silverlightcontrol");
flag = sl.isloaded;
while (!flag) {
settimeout("", 2000);
flag = sl.isloaded;
}
// alert("delay"); // makes work delay introduced settimeout not work
sl.content.findname("txt").text = xmlhttp.responsetext;

}
}


doing wrong ? thank you, spaoind

hi,

could not call web service direct silverlight using webclient object provides asyncronous methods?  alternative call silverlight c# method javascript passing textblock value , c# method set textblock, if post help:

http://silverlight.net/blogs/msnow/archive/2008/07/08/tip-of-the-day-15-communicating-between-javascript-amp-silverlight.aspx



Silverlight  >  Getting Started with Silverlight



Comments

Popular posts from this blog

more indexes

ActiveDirectory

Virtual Channel