R
Rob Mayo
OK, dig this.
You have a custom server control you're building. You have a custom designer for that control. If you add a COM reference to MSHTML, you can determine whether the page your control sits on is in GridLayout or FlowLayout with this code in your designer:
Private Function IsPageInGridMode() As Boolean
Dim text1 As String
Dim blnResult As Boolean = False
Try
Dim element1 As mshtml.IHTMLElement
Dim element2 As mshtml.IHTMLElement
element1 = CType(MyBase.DesignTimeElement, mshtml.IHTMLElement)
element2 = CType(element1.offsetParent, mshtml.IHTMLElement)
'For now, offsetParent will get you the parent element,
'not necessarily the BODY tag. Will add recursive routine
'to get <BODY> later
text1 = element2.getAttribute("MS_POSITIONING")
If LCase(text1) = "gridlayout" Then blnResult = True
Catch e As Exception
Return false
End Try
Return blnResult
End Function
It's dirty, but it works
You have a custom server control you're building. You have a custom designer for that control. If you add a COM reference to MSHTML, you can determine whether the page your control sits on is in GridLayout or FlowLayout with this code in your designer:
Private Function IsPageInGridMode() As Boolean
Dim text1 As String
Dim blnResult As Boolean = False
Try
Dim element1 As mshtml.IHTMLElement
Dim element2 As mshtml.IHTMLElement
element1 = CType(MyBase.DesignTimeElement, mshtml.IHTMLElement)
element2 = CType(element1.offsetParent, mshtml.IHTMLElement)
'For now, offsetParent will get you the parent element,
'not necessarily the BODY tag. Will add recursive routine
'to get <BODY> later
text1 = element2.getAttribute("MS_POSITIONING")
If LCase(text1) = "gridlayout" Then blnResult = True
Catch e As Exception
Return false
End Try
Return blnResult
End Function
It's dirty, but it works