iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Ping
Hi Handy,
Thanks for your new sample. At first sight it seems to fulfill the requirements of the original sample.
But after a closer look I saw that you implemented code in the InitializeColumn event for both grids. There you set the width of the first column according to the selected dropdown value. This is not possible.
The value of the dropdown may only be used to pass it to the database when getting the data. What you are doing here is actually hardcoding the database result. If I would have to implement it this way, I would need a second database call in both InitializeColumn events. As mentioned, the database call takes 30 seconds or longer. If I add unnecessary database calls at other places again, this will greatly reduce performance to make the page unusable.
Therefore we need to cache the database result somewhere until we set the column width. What you try to do here (set the width in InitializeColumn) is probably not possible, because at the time where the column gets initialized, we didn't call the database (InitializeDataSource event) yet. So I still think we have to make several changes to get this working. Any ideas on how to resolve this?
Regards,
Eric
Attached is the original sample with the fixes I mentioned in one of the above posts.
First to your modified code. The hiding of the grids when changing the dropdown works there. You implemented this totally different (I used JavaScript instead), but it works. I have to look a the details yet, but this issue seems to be solved.
Regarding your question about what data should show in what grid. Well, actually if the upper grid is empty, then the lower one should also be empty. But this is just a detail. If you click on a node that is not a leaf-node, then the bottom grid should also be empty. But forget about that. This will be implemented automatically by the data that comes from the database. I will take care of this.
Confusion about change caption and width: When the dropdown changes, yes, the grids become invisible. That's correct. But after the refresh, the grids should have new captions, matching the selection. Please see my initial sample, included in this post again, but this time with this feature working. When you select in the dropdown "data with columns ABC" and press Refresh, you get three columns: A - PD1, B - PD1, C - PD1. The PD1 is the value from the dropdown. When you select a row, you get the same PD1 in all captions of the lower grid as well. If you select "full data (3)" in the dropdown and press Refresh, you get FD3 in both grids as a caption.
And for the column width, now in my attached sample also working, if you select "No data in upper grid" and press Refresh, you get only the Description column, widened to the whole screen and no other columns. If you select "data with columns ABC" in the dropdown, the Description field has normal width again and the other columns reappear. But the lower grid remains empty as long as nothing is selected in the upper grid, so the lower grid still has this full-width Description column and the other columns invisible. Let me know if you still need screenshots or so to see this feature.
Now if I compare this with your latest sample, then these two features (caption changing and column width/invisibling) are removed/non-working in your sample. So we have to re-add those features again. Please remember for any change that you cannot look at the dropdown value if there is data or not. If there is data or not is decided by the database, or in other words in the event handler InitializeDataSource. So don't add code like IF ddl.Value="ND" anywhere outside the InitializeDataSource event handler.
Any ideas on how to restore the removed features again?
To reformulate my initial query, what I need is a sample with the following requirements:
If you find any way to implement all these features, I'll go that way and forget about what I initially wrote.
Thanks,
Looking through my initial code again, I saw that the problem (the disappearing of the columns) in the WebGrid happens between Page.OnInitComplete and Page.OnPreLoad. Actually within the internal method Page.ProcessPostData, where ISNet.WebUI.WebGrid.DLL!ISNet.WebUI.WebGrid.WebGrid.LoadPostData is being called.
You told me that I should change my code to move it to another event. Maybe that would be a good way to start, but actually I don't find any documentation that I cannot use the code in the events I used at the beginning. This solves all my problems, except that WebGrid suddenly drops some columns.
As long as I am not doing anything that's not allowed according to the documentation of the WebGrid, I don't expect such a behaviour. Otherwise it's a bug either in WebGrid or in the documentation. Can you check which of the two please?
So how should we go on? Do you still think we should try to fix all side-effects of changing the code by using the PrepareDataBinding event? Or wouldn't it be better to stick what we have and try to fix the problem with the WebGrid?
And what about the confirmed bug with the slider? Any news there?
In my original samples this was all working, but because I didn't pay attention to this, it was set up in a way that you can easily overlook it. Here is how to see this functionality in my original sample:
- The "set both grids invisible" when the dropdown changes (until the user presses Refresh button) was fully functional. Please look again.
- The feature to change the column with of the first column to full width was implemented. But because I changed the columns, the description column was not the first column anymore. In grdUpper_Init and grdLower_Init, please move the AddGridColumn call for the Description to the beginning. Otherwise other columns will be first and in SetColumnVisibility the first code line will not detect the text (it checks tbl.Rows(0).Cells(0).Value).
- The feature to change the column captions was functional. It changes everything with XXX to the value of the currently selected dropdown. But no caption was XXX, so you couldn't see it. In grdUpper_Init and grdLower_Init please change in the call to AddGridColumn the fourth parameter from "A" to "A-XXX" and the same for all three others. (AddGridColumn(grdUpper, "A", "A", "A", ... to AddGridColumn(grdUpper, "A", "A", "A-XXX", ... and the same for A, B, C, D).
I hope you can see that this was working previously. But sorry, that I didn't mention this explicitely. If you can help getting my initial sample working without losing any functionality but removing the crash with the disappearing columns, it would be great.
And do you have any feedback from the developers related to the slider problem already?
Thanks for this modified sample. You made many changes there.
Things I found:
Page.RegisterHiddenField doesn't compile (I replaced it by ClientScript.RegisterHiddenField)
grid.RetrieveStructure in both PrepareDataBinding event handlers doesn't work for me. I added column creation code there instead.
The current setting of the dropdown must change the captions of the columns in both grids. In my original sample this was implemented, but I think the captions were set in a way that it didn't really change. So you probably overlooked this. I'm trying to add this to your changed code, but I'm not sure how to do so. Right now my code doesn't work this way.
In reality changing the dropdown and pressing Refresh takes a minute or so (to get the data). That's why we implemented the Refresh button. But if the user changes the dropdown and forgets to press the Refresh button, the current screen reflects data that is not true; the values in the grid don't match the dropdown selection. That's why in my sample I set the grids to invisible and only the Refresh button sets them back to visible due to a refresh. I'll try to implement this also again into your sample.
Also the functionality that if no data is in the grid, then all columns should be set to invisible except the first column. The first column should be extended to fill the whole screen (lets say fixed 500px). As soon as the grid is refreshed with data, the missing columns should get visible again and the size of the first column readjusted to it's default size.
I'll have to look a little closer at the changes, but maybe you can tell me right away how to implement these now missing features.
Your proposed change to move all code which was in SetColumnVisibility, SetColumnCaptions and column generation into PrepareDataBinding event has another unwanted side effect: The code in SetColumnVisibility doesn't work anymore.
The problem is that first the event InitializeDataSource is being called. In this event, if there is no data, one row with the text "No data available" will be filled into the grid. In SetColumnVisibility this will be detected if number of rows is one and the strings do match. (Not the best method though.)
Now before SetColumnVisibility gets called, all columns are removed and recreated. This has the effect that when the code in SetColumnVisibility accesses the grid, there is no data in the first cell.
So by moving the code into PrepareDataBinding we now have already two unwanted side effects (empty grid detection doesn't work anymore and the column resizing problem). I think this moving wasn't the best idea.
Either we need to fix all occurring side-effects of this change or we have to find another solution to fix the initial problem (disappearing columns yielding to a crash).
Also the non-working slider issue is still open, not sure if this is related or not.
On other pages I don't use the Refresh button, but it auto-refreshes when the dropdown changes (auto postback on the dropdown). On these pages the titles of the grid (only one grid there) will not get updated then.
This problem is fixed now. Before adding the new columns (now in PrepareDataBinding) I didn't call grid.RootTable.Columns.Clear() in our project (not in the sample), so the columns were added instead. And then the code in SetColumnCaptions didn't work anymore, because it had already the modified header captions.
The other problems still remain.
I agree that the width problem is a minor issue. But it still needs to be addressed. When the columns get created (now in PrepareDataBinding) I have to give them a width. So if the user changes the width, how should this remain if the columns get recreated in every PrepareDataBinding? I don't see a way to achieve this by still using PrepareDataBinding the way you recommended.
I don't understand what you mean with the FlyPostBackSettings. I stepped through the whole code without this change and cannot see anywhere an access to the dropdown returning an 'ND' (when it's on a different setting). Can you explain this in more detail?
For the other problems, I'm still working on creating more samples for you.
Did you get any feedback for the slider bug already? I'm not sure if I will be able to create a smaller sample, but in case I do, I'll let you know.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname