Thanks for the sample Luca
How do I populate the Data Grid View Correctly as I need at least one row in the Multicolumn Combo Box for each row, to obtain the initial display value.
The issue with the sort is the control is being reset in my code and I don’t understand why, the code below is called which does not happen in your sample.
Tests show that the Control is already Null when this code is called
public DataGridViewMultiComboBoxColumnCell()
{
this.Control = new MultiColumnComboBox()
{
Border = BorderStyle.None,
Dock = DockStyle.Fill
};
}
Thanks for your help
Ewan
Hi Frank,
thanks for your help!
Let me any update.
Screenshot
See attached sample. It has 2 column classes, one is the revised DataGridViewProgressBarColumn which now has a TrackBar editor. In this case, since the TrackBar doesn’t use the Text property for the value, it implements the IDataGridViewEditingControl. The second column is a DataGridViewUpDownColumn using a custom NumericUpDown control to edit the value.
The DataGridViewColumn.Editor is not visible in the designer – you need to set it in code.
Hi Luca
Just to be clear if I use a Column Editor which I cannot find in the designer or Wise J 2 tools.
So where do I pick it up from?
When the Data Grid View is loaded will it look like the attached, given the actual values in the data grid view are payroll numbers?
(From what you say it appears using my current approach that the cell data source is being lost on sort which explains why all the cells revert back to payroll numbers.
If I click on a drop down no data is present)
Thanks for your help
Ewan
Hi Luca
The image does not show unless I use cell update(). Presumably the UserPaint needs set when the grid is initially populated
Could you let me know which part of the theme I would need to create a mixin for the hide the default row header glyphs
Many thanks for you help
Ewan
Hi Luca
The image does not show unless I use cell update(). Presumably the UserPaint needs set when the grid is initially populated
Could you let me know which part of the theme I would need to create a mixin for the hide the default row header glyphs
Many thanks for you help
Ewan
I just tried, the AspNetWrapper control in Wisej works very well. The problem is that ASP.NET doesn’t work the same way as Wisej and your code cannot update the DevExpress ASPxSpreadsheet control because you are saving a reference to the instance that doesn’t exist anymore. Wisej makes it too easy… 🙂
The same approach used in your sample doesn’t work in any framework, including ASP.NET itself. ASP.NET controls do not exist past the page cycle. VB.NET (or C#) code can interact with an ASP.NET control only when the page is initialized or loaded (which is during a page request from the browser). After the response (which is a large concatenated HTML string) is sent back, the ASP.NET controls are discarded. They will be all recreated from scratch at the next request (or postback for a form).
If the clicks in your sample were coming from an ASP.NET page, it would work because the click issues a full page request and the entire ASPxSpreadsheet is recreated. Wisej is a Single Page Application (SPA) system completely based on asynchronous (ajax) communications. Very similar to a single ASP.NET update panel. If you tried to update the ASPxSpreadsheet in an ajax request in ASP.NET it would not work. See https://www.devexpress.com/Support/Center/Question/Details/T399187/how-to-refresh-aspxspreadsheet-without-refreshing-the-whole-page.
This is why the AspNetWrapper shows the WrappedControl property which is the reference to the live instance of the ASP.NET control. If you save that reference in your code you are referring to a “dead” instance past the Page_Init, Page_Load (etc, see reference doc).
Basically, ajax code can use ASP.NET control only during a page request.
You can do this:
Add a method to the wrapper
Public Sub Test()
doSomething = True
Update()
End Sub
Dim doSomething As Boolean
Private Sub CDevexSpreadSheet_Init(sender As Object, e As EventArgs) Handles Me.Init
If (doSomething) Then
Me.WrappedControl.Document.Worksheets(0).Rows(1).FillColor = Drawing.Color.Red
End If
End Sub
Now you can call Test() at anything from an ajax event coming from a Wisej control. The method Test will call Update() which will reload the spreadsheet.
To prevent the full reloading, see the explanation at the DevExpress support forum: https://www.devexpress.com/Support/Center/Question/Details/T399187/how-to-refresh-aspxspreadsheet-without-refreshing-the-whole-page
You can assign the ClientInstanceName in Page_Init and you will find it on the client side.
Me.WrappedControl.ClientInstanceName = "Spreadsheet1"
Then in Test() instead of Update(), call this:
Eval("this.getWindow().Spreadsheet.PerformCallback()")
It will update the ASPxSpreadsheet using a postback as advised by DevExpress.
You may get other problems after this in your sample because the way it’s written it recreates the sheet on every load, which conflicts with the typical ASP.NET postback model. In the AspNetWrapper we also expose IsCallback and IsPostback. This way you can check if the load event is fired because of an ASP.NET postback.
In other words, anything you want to do to the ASPxSpreadsheet object can only be done while inside Page_Init or Page_Load or the other page initialization events.
HTH
Hi Luca
Could you post a code snippit that demonstrates how to use the column editor property to assign a multicolumn combo box to a column and populate its data source.
Thanks for your help
Ewan
I cannot reproduce. The cell control is bound to the correct cell also after sorting since it saved with the cell.
It seems that you are creating a cell control for each cell? It’s kind of overkill to simply use a custom editor. Columns have the Editor property that you can assign once and it will use your editor for the cell only when in edit mode saving a lot of resources.
The background image is correct. The row header is too narrow.
The paint event is fired when UserPaint is on and in the code you attached it’s turned on probably too late.
The call to cell.Update() is not needed.
I hope the sample project will do for the problem demonstration purpose.
After initialising the spreadsheet is like dead. Nor row add, hiding, painting and so on. Only cell value setting works.
Also I need active cell change event.
Thank you!!!
Hi Frank
What I found though was despite a double click being raised the single click code was visited anyway even though code should have only been visited if e.clicks = 1
Thanks
Ewan
This code works fine until you sort the DGV. Sorting results in the Data Grid View cells becoming disconnected from their control.
See attached images
Hi Luca
I have retested and it works so I come to the conclusion, that the issue is caused by an interaction between either debugging on visual studio or another website I am using
Thanks for your help Ewan
Hi Luca
I have retested and it works so I come to the conclusion, that the issue is caused by an interaction between either debugging on visual studio or another website I am using
Thanks for your help Ewan
Hi Luca
The code I an using is as below as the paint event does not fire when I need it to. In the attached image the Edit Glyph is superimposed over the select Glyph
dgvOfficeStaff.Rows[e.RowIndex].HeaderCell.UserPaint = true;
dgvOfficeStaff.Rows[e.RowIndex].HeaderCell.Style.BackgroundImageLayout = Wisej.Web.ImageLayout.BestFit;
dgvOfficeStaff.Rows[e.RowIndex].HeaderCell.Style.BackgroundImageSource = “table-row-editing”;
dgvOfficeStaff.Rows[e.RowIndex].HeaderCell.Update();
Hi Simone,
thanks, logged as #1795.
Best regards
Frank
Hi Wilfred,
thank you. It´s logged as #1794. We´ll inform you when a fix is available.
Best regards
Frank
Thanks Simone.
Logged as #1793. We´ll inform you when it´s fixed.
Best regards
Frank
