It’s possible to place a userpopup under columnheadercell of a datagridview?
I can not use the ShowPopup (control) method by passing headercell as a parameter because headercell is not a control. Using ShowPopup (x, y) I have the problem of how to calculate the headercell coordinates (especially if datagridview is nested in other containers).
Any suggestions?
thanks in advance
Yes, you can add a ShowPopup method that takes in a DataGridColumn component:
public class UserPopupEx : UserPopup { public void ShowPopup(DataGridViewColumn column) { Show(); CreateControl(); Eval(String.Format("this.showPopup(Wisej.Core.getComponent('{0}').getHeaderWidget())", ((Wisej.Core.IWisejComponent)column).Id)); } }
Short explanation of the Eval line:
“this.showPopup” invokes the showPopup method on the client which takes in a widget as a parameter.
“Wisej.Core.getComponent(‘{0}’)” retrieves the component that corresponds to the specified ID. In this case, the DataGridViewColumn component.
“.getHeaderWidget()” returns the widget for the column header, associated with the DataGridColumn component.
Luca,
My application is in VB. I tried your solution by converting from CSharp to VB but it does not seem to work.
I probably made some mistake in converting (I’m not very practical about Csharp). Could you give me the VB code version?
Thank you
Hi Angelo,
I didn’t test it but the VB version should be
Imports Wisej.Web
Public Class UserPopupEx
Inherits UserPopup
Public Overloads Sub ShowPopup(ByVal column As DataGridViewColumn)
Show()
CreateControl()
Eval(String.Format(“this.showPopup(Wisej.Core.getComponent(‘{0}’).getHeaderWidget())”, (CType(column, Wisej.Core.IWisejComponent)).Id))
End Sub
End Class
Thank you Luca,
I’ve tried your solution but it still does not work.
I think the problem is in the eval line.
When I run it, I get an error: “invalid or unexpected token”.
Probably “this.showPopup” is incorrect because ‘this’ is CSharp syntax.
I replaced it with “me.showPopup” but it still does not work and I always return the same mistake.
Any suggestions?
It’s “this” since it’s a javscript exception. The invalid token may be the single quote. Make sure it’s the correct single quote. The VB code pasted by Tiago shows the wrong single quotes (‘{0}’) since wordpress has a habit of changing the quotes.
Ok
Now it works perfect.
I confirm that the problem was the single quote
Thank you very much
Please login first to submit.