User Profile & Activity

Ahmed Dajani Member
Page
of 6
Posted: July 31, 2012 12:30 PM
- Same webgrid as above.

- I'm binding to an ObjectDataSource.

- Creating the columns dynamically in Server Side InitializeLayout event (I have 80+ columns).

- My delete method takes two paramters.

- No checkboxes

I want to be able to select as many columns (1 or more), right click to Delete from the ContextMenu or from an outside button on the page somewhere and delete all selected rows.
Posted: July 30, 2012 11:14 AM
Hans,

I tried implementing the attached, but it did not work. The only difference I see in our code is I have 2 paramters for my delete function in my object data source. Does that affect it?

I can step through the JS code in my debugger and everything seems to work just fine, but the wor never gets deleted from the grid. I refresh the page to see if the changes go through but it doesn't. I also tried adding a refreshGrid() call, but that also didn't work.

Please advise. Thanks.
Posted: July 27, 2012 10:16 AM
Yes I do.

How can I delete multiple rows without using Batch Update using "Delete Selection" ?
Posted: July 26, 2012 10:59 AM
Hi Hans,

Thanks for the reply. This is not quite what I was going for, but I understand now what I am trying to achieve is not possible. My end goal was to be able to delete multiple rows at the same time without having to click "Accept Changes".

Now I set Batch Update to FALSE, and have a delete method specified in my ObjectDataSource. If I select multiple rows, and choose "Delete Selection", it only deletes one row. I'd like to be able to delete all selected.

Thanks.
Thanks Bernard. Works!
Posted: June 21, 2012 12:54 PM

Thanks Hans, but this doesn't solve the problem.

I downloaded the latest hotfixes and updates but that hasn't worked either.

To recreate:

1. Create a grid with the same columsn I've created above.

2. On initial page load, you can create a List(of String()) of some values i.e.

dim rowData1 as String() = {"", "1", "1", "(", "1", ",", "1", ",", "1", ")", "1", "", "")
dim rowData2 as String() = {"", "2", "2", "(", "2", ",", "2", ",", "2", ")", "2", "", "")
dim myList as new List(of String())
myList.add(rowData1);
myList.add(rowData2);

dim newRow as New WebGridRow(myList);
myGrid.RootTable.Rows().add(newRow);

Add as many of these as you want. Save this list in the session somewhere too.

3. Add a button on the screen that will create a post back. For that buttons handler, retreive the data from session, iterate through the list and add the rows again i.e.

''' <summary>
    ''' binds this list to the grid
    ''' </summary>
    ''' <param name="results"></param>
    ''' <remarks></remarks>
    Private Sub BindGrid(ByVal results As List(Of String()))
        ' Note (XXX): we can't bind the grid by simply setting the datasource property since this is a list of string arrays
        ' we have to iterate through the list and add each row manually
        If results IsNot Nothing Then
            For i As Integer = 0 To results.Count - 1
                Dim data As String() = results(i)
                Me.wbCompareResults.RootTable.Rows().Add(New ISNet.WebUI.WebGrid.WebGridRow(data))
            Next
        End If
    End Sub

Below is the RowInitialize handler for the grid. I am inserting a checkbox for the first column:

Private Sub wbCompareResults_InitializeRow(sender As Object, e As ISNet.WebUI.WebGrid.RowEventArgs) Handles wbCompareResults.InitializeRow
        If e.Row.Type = ISNet.WebUI.WebGrid.RowType.Record Then
                ' add the checbox control 
' I had some other code here for the checkbox, but this should be sufficient.
e.Row.Cells(0).Text = "<input type=""checkbox""/>" End If End Sub


I also added the client side OnInitialize function you provided.

Looking forward to your response.

Posted: June 8, 2012 11:00 AM

What about the WebGrid row shift issue?


Thanks

Posted: June 7, 2012 10:42 AM

Hi Bernard,

After the update yesterday, the WebGrid version is: 7.0.7200.533

But I don't seem to have the WebDesktop.NET 3.0 folder.  Did it get deleted with the update?  How can I get it back?

 

Thanks

Posted: June 6, 2012 3:46 PM

Hi Bernard,

I had the older version of the WebGrid.  So I ran the update manager and updated my WebGrid.  But that behavior still exists.  I am on IE8.

That said, after the update, I havent been able to make a successful deployment.  I keep getting the Context Menu error suggesting that I need to register the SmartWebResources.  Which I did.  I noticed the between my last deployment and the current one.  My project is missing the WebDesktop.dll and WebDesktopResources.dll which I assume are the two files I need for this and based on a thread I saw on here. 

What is the best way to go about making sure that all my refrences in my project are current.  Because I can't seem to find those 2 dll files anywhere to get this to work again.

Thanks

Posted: June 4, 2012 10:19 AM

Yes, it is working fine now.  Thank you & regards.

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