fabulous Level: VB Guru

 Registered: 03-08-2002 Posts: 439
|
Re: why web user control can not run independly ?
I am not sure I fully understand your question. If you clarify I think we will be in a better position to help you.
From what I can make out, you are either asking about why you cannot run a web control on its own or why your web control appears as a gray box if you add it to the designer.
If your question is the 1st:
A control, be it web or windows forms control, requires a host to run. A host in this case is a container that supports whatever technology that was used to create it. Such technologies for example are ActiveX and .NET. A windows form and a web form are ActiveX and .NET aware hosts meaning that controls made using this technology can be used successfully on these platforms. You cannot launch a control to run on its own.
If you are referring to why your control doesn't paint the way it does in the web browser when you run the application:
This is one I haven't verified as yet. My suspicion this: The Web Form designer surface is not the same as a browser. Web controls are rendered as HTML at run time and so it is possible that these cannot be displayed on the designer. A representation of the control is then made using a gray box. AT run time however, the control is rendered as HTML and the browser gets the HTML that corresponds with your control.
Also note that IIS is the engine that creates your html (in this case using ASP.NET) and if the IDE was to send a request to IIS for the HTML of the control this would slow down development drastically. Also note that most Web Controls require session information or other data to display what they have to. At design time there is no session to talk about so you would receive exceptions if your control is to be run.
I have seen other controls display properly on a webform. An example is FlashInside by AiXtend. This control is available in a compiled DLL. This could be one of 2 reasons. For it to run it has to be compiled first or that this is a Flash viewer control and thus requires flash to be on the machine and does not necessarily require HTML representation. The designer can host a Flash control.
Hope this helps. Happy coding.
____________________________
My boss is a Jewish Carpenter (Jesus Christ)

Brain Bench Certified VB.NET Developer
|