User Profile & Activity

Eric Member
Page
of 19
Hi Handy,

I think the problem is that in FlyPostBack (InitializePostBack event), where I handle the button press, I use grid.ClientAction.Refresh to refresh the grid data after the merge button was pressed.

Because of this data (grid) refresh, the property RestoreExpandedChildRows probably has no effect, because this works only for normal FlyPostBack events like resorting etc.

Can you look at the sample again and tell me what to fix there so that it works? I tried to cache the expanded nodes like it was necessary before the property RestoreExpandedChildRow existed, but it doesn't work.

It would be great if you could fix the demo I created for you.

Thanks,

Eric

Hi Handy,

Thanks for your helpful answer. First I searched for this property, but both Google and your site returned zero results. Then I assumed there was a typo. I also thought that WebGrid 6 doesn't support this feature. But I remember that we upgraded to WebGrid 6 not so long ago, so maybe this was valid only for WebGrid 5. Anyway, I found the property in the meantime. It is called RestoreExpandedChildRows and is located on the LayoutSettings tag.

I have set this to true and removed all other previous code to expand / collaps by JavaScript. Unfortunately  it is still not working. Are you sure this should work with WebGrid version 6?

Can you modify my last sample so that it works? With this property or by any other means.

And yes, this is the main problem remaining.

Thanks,

Eric


Hi Handy,

Ok, no partial refreshes possible.

And what about my remaining questions?

  1. When clicking on Merge or Unmerge, the hierarchical tree collapses. I tried to save all expand/collapse status in the Session, like I've done this on other places already, but it's not working. Current demo source included (in earlier post).
  2. Expand/collapse status should not go into Session at all, because users might have several browsers open with the same application in it. But first goal is to get this working at all.
  3. Verify that this design is correct.

Most important is now getting the expand/collapse to work (remain as it is when clicking merge/unmerge).

Regards,

Eric

Any update?

Hi Handy,

No chance to install any software. I would upgrade from our IE6 first.

Data storage for the boolean merge value per row is stored now in a hidden field as you can see in the example v2. So that part works now.

Remaining problems are (copied from post above):

  1. When clicking on Merge or Unmerge, the hierarchical tree collapses. I tried to save all expand/collapse status in the Session, like I've done this on other places already, but it's not working. Current demo source is included with this post.
  2. Expand/collapse status should not go into Session at all, because users might have several browsers open with the same application in it. But first goal is to get this working at all.
  3. Refresh after merge should not refresh the whole grid, but only the part that changes.
  4. Verify that this design is correct.

Most important is now getting the expand/collapse to work (remain as it is when clicking merge/unmerge).

Regards,

Eric

Ok, I can store the merge-status now. The problem was that I tried to store it in the ViewState and during FlyPostBack the ViewState changes will not get saved onto the page.

Fixes to do this:

  • Entirely remove the server-side ButtonClick handler
  • In JavaScript ButtonClickHandler find out the ID (attached as CustomAttributes to another column), then read if the shown image is a plus or minus GIF, then call webGrid.AddInput to give data back to the server side, then call grid.SendCustomRequest
  • In the FlyPostBack handler (InitializePostBack method) I read the given parameter and attach it to a hidden form field. Then I call grid.ClientAction.RenderControl so that it gets updated on the client side. To refresh the data below, I just call grid.ClientAction.Refresh
  • In InitializeRow I look at the hidden form field to determine if we should show the plus or the minus graphic.
  • In InitializeSelfReferenceDataSource I look at the hidden form field to determine if I should call the DB with the Merge-Flag with true or with false.

Now this all works. Remaining problems are:

  1. When clicking on Merge or Unmerge, the hierarchical tree collapses. I tried to save all expand/collapse status in the Session, like I've done this on other places already, but it's not working. Current demo source is included with this post.
  2. Expand/collapse status should not go into Session at all, because users might have several browsers open with the same application in it. But first goal is to get this working at all.
  3. Refresh after merge should not refresh the whole grid, but only the part that changes.
  4. Verify that this design is correct.

Most important is now getting the expand/collapse to work (remain as it is when clicking merge/unmerge).

Regards,

Eric


Hi Handy,

Yes, nothing happens - that's the missing part I'm asking for.

What should happen: All entries (hierarchically) below the clicked button should be removed from the grid and replaced by what a new call to the DB function returns. This new call to the DB function has to get the input parameter DoMerge=True. Then the button should change to a "minus". When the user clicks on it again, all data below the clicked node should get removed from the WebGrid and replaced back with the data that comes from DB call with DoMerge=False. Then the button should change back to a "plus", like on the beginning.

Remote Desktop? You mean you access my PC? That's not possible here. There are hundrets of company firewalls and proxys and stuff inbetween.

I tried to save the merge-status in the ViewState, but even on normal postbacks (when a node gets expanded) the ViewState is cleared for some reason. I also don't want to save the data in the Session, because users often have several browser windows open. Maybe fix the ViewState problem or save it in a hidden input field or so?

Regards,

Eric


Hi Handy,

It took me several days to create this example. I hope it was worth the effort. The problem I had was that WebGrid showed unexpected behaviour when running this form standalone (out of our project). After long investigations I found out that in my sample I didn't use a Session object. Without touching the session, WebGrid doesn't work - probably another bug. You can see that in my sample if you comment out the line Session("abc")="def" in Page_Load. But anyway, now you have a sample.

When you click on one of the "plus" buttons in the merge column, then the grid data below there should get merged. What data is expected you can see from the data generation function.

If you "merge" a node, it actually should show all data rows below it, but not the "folder-type" rows.

So, here's the sample. Copy the ISNET dll's into the bin folder and also:

AjaxControlToolkit.dll, AJAXExtensionsToolbox.dll, System.Web.Extensions.Design.dll, System.Web.Extensions.dll, VwWebSite.Interop.dll

I'm using Framework 3.0.5000.705 and WebGrid 6.0.7200.220. Please use the same version.

Regards,

Eric


Hi,

I never set WebGrid to "read-only" or something like that. It's just that I don't change the data in the WebGrid. And I think ViewState (of the page) would be ideally suited to store these values temporarily. Why shouldn't that work? And if not, what should I do? This must be possible somehow - it's trivial from a users perspective.

Regards

Any updates?

---

So you know the requirements now. To repeat: I have a read-only hierarchical WebGrid. I need a button per row (is implemented) and I need a binary value per row with the merge/unmerge display status. Clicking on the button should invert this status. This status doesn't need to get stored anywhere, but it must be preserved during postbacks etc. Changing this status per row also changes all shown data in the hierarchical grid below the clicked node, so the data in the grid needs to get refreshed in that case. How would you implement all this?

All times are GMT -5. The time now is 1:29 AM.
Previous Next