Hi,

I have created a Windows UserControl. This Control hosts a PropertyGrid and
a Button control. The UserControl project also includes a class called
"TestClass" and a custom TypeConvertor class called "DDConv".

When the user clicks on the Button control, the application assigns an
instance of "TestClass" to the PropertyGrid.

The "TestClass" has a property called "CustProp" and it has an
TypeConverter attribute assigned to the "CustProp" property. The
TypeConvertor points to the "DDConv" class.

The PropertyGrid in the UserControl displays a DropDown against the
"CustProp" property when the UserControl is hosted in a windows application.

When the UserControl is hosted in Internet Explorer, the PropertyGrid does
NOT SHOW any DropDown for the "CustProp" property.

NOTE: I test the UserControl in Internet Explorer from a virtual directory
on my machine. I have set "FullTrust" for the "LocalIntranet_Zone" on my
machine.

I want the PropertyGrid to display the DropDown in Internet Explorer - can
someone help me in figuring out how to acheive the same?

'TestClass.vb
Public Class TestClass
Dim _name As String
Dim _ddProp As String

Public Property Name() As String
Get
Return _name
End Get
Set(ByVal Value As String)
_name = Value
End Set
End Property

<System.ComponentModel.TypeConverter(GetType(DDConv))> _
Public Property CustProp() As String
Get
Return _ddProp
End Get
Set(ByVal Value As String)
_ddProp = Value
End Set
End Property

End Class

'DDConv.vb
Public Class DDConv
Inherits System.ComponentModel.StringConverter

Dim _values As String()
Dim _restrictToList As Boolean

Public Sub New()
_values = New String() {"Yes", "No"}
End Sub

Public Overloads Overrides Function GetStandardValuesSupported _
(ByVal context As _
System.ComponentModel.ITypeDescriptorContext) As Boolean

Return True
End Function

Public Overloads Overrides Function GetStandardValues(ByVal _
context As System.ComponentModel.ITypeDescriptorContext) _
As _
System.ComponentModel.TypeConverter.StandardValuesCollection

Return New StandardValuesCollection(_values)

End Function

Public Overloads Overrides Function GetStandardValuesExclusive _
(ByVal context As _
System.ComponentModel.ITypeDescriptorContext) As Boolean

Return _restrictToList
End Function
End Class

Thanks & Regards,
Dhwanil Shah
dhwanil.shah@patni.com

--
Message posted via http://www.dotnetmonster.com

Re: PropertyGrid - Internet Explorer hosting problem by Dhwanil

Dhwanil
Fri Mar 18 01:09:29 CST 2005

Hi,

I "discovered" what was wrong with this - somehow IE was "looking" for the
dll which had the TypeConverter - even when that was the DLL which exposed
the UserControl that IE was hosting.

When the PropertyGrid tried to use a custom type converter - it tried to
create an instance of a class from its fully qualified assembly name. While
trying to create this instance, IE (or .NET Framework or PropertyGrid)
tried to download the required DLL (again). IIS on the server kept on
returning 401 (for whatever reason). That was the reason the TypeConverters
were not working. I discovered all this by monitoring the requests and
responses between IE and IIS (I used the Fiddler tool from Microsoft -
available at http://www.fiddlertool.com)

While trying to resolve another problem in the application - I read Paul
Wilsons blog at
http://weblogs.asp.net/pwilson/archive/2003/05/30/8037.aspx. In that he
explained / gave refrence regarding how to make IE / .NET Framework
understand how to locate and download the assemblies. Based on that, I was
able to give IE / .NET Framework absolute location for the .DLL that was
being hosted by IE.

Refrences -

1. WinForm UserControls in Internet Explorer
http://weblogs.asp.net/pwilson/archive/2003/05/30/8037.aspx

2. PRB: Runtime Probe Causes a Delay When You Load a Windows Forms Control
in Internet Explorer
http://support.microsoft.com/default.aspx?scid=kb;en-us;814668

Regards,
Dhwanil Shah

--
Message posted via http://www.dotnetmonster.com