How to show message for failure to display IE-Hosted windows forms control

m_ogden

Well-known member
Joined
Mar 3, 2006
Messages
74
Location
New Hampshire
Programming Experience
5-10
I have a windows forms control hosted in my asp.net 1.1 application, but the control requires security changes... so until the user installs the application (which only sets security) they will only get a blank square where the control should be displayed.
I would like to either prompt the user to install the application, or display an error message instead of this blank box.
According to the HTML/DHTML reference it should be possible to include a SPAN element in the OBJECT element and the innerhtml of the SPAN element will display if the object fails to load.
This may work for ActiveX, but it doesn't work for my .NET control...
Is there any way I can display a message to the user with instructions to install the app in this situation without them seeing the blank square?
Thanks!
 
I came up w/a solution...
I put a public readonly property inside of my windows forms control called 'IsVisibleToUser' which always returns true (it doesn't matter what that property is called). When the page loads I use javascript to get the OBJECT element and check for the value of the IsVisibleToUser property. If the control loads properly it will return true... if it doesn't load it will be undefined to javascript. When that occurs I remove the OBJECT tag from it's parent and append a DIV element w/Error.
for example:
VB.NET:
function checkControlIsLoaded(){
var bOk = false;
var myCtl = document.getElementById('FileUploadCtl');
if (myCtl){
   if(!(myCtl.IsVisibleToUser == undefined)){
      bOk = true;
   }
}
if(!bOk){
  //remove object tag and append a new div w/html
}
}
 
Back
Top