User Profile & Activity

Eric Member
Page
of 19

So how would that work in my example?

Add a dynamic script somehow in PreRender to do that on the client side?

Hi Handy,

Sorry for the delay in testing this. I couldn't test the beta version on our production system and hoped that in the meantime a new stable version comes out. But as you moved to release 7, it looks like there are no more updates to version 6.

Yes, this hotfix seems to work for my sample. I just updated ISNet.WebUI.WebGrid.dll and ISNet.WebUI.WebGrid.Resources.dll from version 6.0.7200.218 to version 6.0.7200.220 and my sample doesn't crash anymore.

Let me know when the status of your control has made it from "nightly build hotfix" to a stable, tested version.

Thanks for your support.

Regards,

Eric

Posted: September 1, 2010 12:47 PM

It also doesn't work, if the columns BlockId and ParentBlockId are hidden (Visible="false") and they do not have a Caption. I don't know why hidden columns must have Caption, but if you miss this attribute, the little plus-image for expanding the node also doesn't appear. That's probably another bug. As a workaround, just set Caption="".

Posted: September 1, 2010 9:15 AM

If found my problem. I have this code:

<RootTable DataKeyField="Block_Id">
	<Columns>
		<WebGridColumn Name="Description" DataMember="Detail_Name" />
		<WebGridColumn Name="BlockId" DataMember="Block_Id" />
		<WebGridColumn Name="ParentBlockId" DataMember="Parent_Block_Id" />
	</Columns>
	<SelfReferencingSettings ChildDataMember="Parent_Block_Id" Enabled="True" ParentDataMember="Block_Id" ExpandColumnMember="Description" LoadOnDemand="True" />
</RootTable>

The two attributes ChildDataMember and ParentDataMember both point to a DataMember value of WebGridColumns. But ExpandColumnMember ("Description" above) is not the DataMember of a WebGridColumn, but the Name of a WebGridColumn. So for the example above I have to use ExpandColumnMember="Description" instead of ExpandColumnMember="Detail_Name". The code above shows the corrected version.

Where I copied it from, both Name and DataMember were the same, so it worked there.

Unfortunately WebGrid doesn't give any error message if ExpandColumnMember is wrong or cannot be not found; it simply won't show the "plus" to expand the node.

Hi Glenn,

Thanks for your new sample.

We use the WebGrid version 6.0.7200.218 (as mentioned in initial question) and framework version 3.0.5000.705 (ActiveReports.Exporting.dll version 5.0.7200.3).

Yes, there are several problems with the sample, like that both Update buttons don't work, the crash, etc. but I can ignore all this, as long as this happens only in the sample and not in our real project. If you would still like to investigate, I'm happy to help. (I don't think it's related to this minor version difference.)

Ok, so with your sample I could add the row on the server side. I had to change a little bit, because casting to a DataSet didn't work. Here is what finally helped me (VB.NET):

Dim dt As DataTable = CType(grid.DataSource, DataTable)
Dim values() As Object = {1, "init", "value", 0.0, 0.0}
dt.Rows.Add(values)
grid.RebindDataSource()

I'm not finished yet, but I assume there will be no other problems related to this. If there are, I will reply again or open a new thread (if not directly related).

Thanks,

Eric

One more info on this: The old application worked - at least regarding the unbound data handling. I think it's a bad design, but decide yourself. If I cannot find a better solution quickly, I'll will use this also. Here it is:

In Page_Load the data for the grid is loaded from the database. The full DataSet is stored in a Session variable. Then calls to grid.ClearCachedDataSource() grid.DataSource=(from session), then grid.DataBind(). The event grid_InitializeDataSource is not implemented.

When clicking the Add button, the modal popup, opened by JavaScript in the OnClientClick event selects the data and stores the ID in another session variable. In the button handler event (server side) the DataSet from the session is being read. A new DataRow is added and again grid.ClearCachedDataSource, grid.DataSource=, grid.DataBind is set.

I think it is bad to store the full dataset in the session (and also the ID of the selection dialog). If not other possible, at least ViewState for the DataSet should be used. But I think this data belongs to the WebGrid, and I should not cache this data in my code again.

Eric

Hello Glenn,

Thanks for your answer. BulkUpdate sounds like letting WebGrid do all the Update, but all at once. I looked through your sample and the BulkUpdate description, but I'm still missing something. Also, I'd like to mention the differences:

- The final Save to the database is done by me (server side) through a single call to a stored procedure (passing XML with all the grid data). In your sample you are somehow using a DataAdapter instead.

- I'm not sure what I'm missing, but when I click the button "Add Row" your sample crashes. The JavaScript GridAddRow runs successfully through, but then, within WebGrid code, somewhere it crashes. What happens is that a window pops up showing an unhandled exception (NullReferenceException in WebGrid.DataBinding). I can only click on Copy or Close.

- What's the exact purpose of the AddRow/UpdateRow handler setting e.ReturnValue=false?

- The main difference to what I need is that you add the data by the JavaScript GridAddRow. I have to add the data on the server side, because I need to get the data from the database first. I don't know how to add a row to the WebGrid on the server side without letting WebGrid go through a InitializeDataSouce call.

Any hints on this?

Eric

 

Thanks for the update. I'll post feedback when I have tested it.

??? Is this a typo?

Did you want to say that you thought that I was using WebGrid version 7? If your sentence was correct instead, then I don't understand what you wanted to say.

I mentioned the version in my initial mail.

So, I'll wait for more information then.

Hi Handy,

Thanks for the update. But before testing this, I need some more infos. We just bought the update to version 6 a few months ago. Will this version 7 component work with our license for version 6?

If your build has not been regression tested (whatever this means in detail), then I prefer not to use it on our production system yet. But of course I can test it to give you feedback if it works now.

Thanks,

Eric

 

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