Welcome Guest Search | Active Topics | Sign In | Register

Grid Deleted Item Options
Basit
Posted: Saturday, September 24, 2011 3:07:26 AM
Rank: Newbie
Groups: Member

Joined: 9/24/2011
Posts: 9
Dear Sir/Mam,

I download trial software before i purchase i need to check the features. Its good component. But i stuck on grid deleted item. when i deleted the row its deleted but actually not deleted i know its behaviour of grid. but i want fully delete becoz when i save the record after one row deleted from grid when i wrote this code
For i = 0 To Grid1.RecordCount - 1

Next its shows the deleted item row. i dont want this row. i also wrote the code in java script
function OnItemDelete(grid, itemIndex, colIndex, commandName) {
if (window.confirm("Sure to delete data?")) {
grid.deleteItem(itemIndex);
}
} but no success. Thanks
Basit
eo_support
Posted: Saturday, September 24, 2011 7:45:08 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You will need to check GridItem.IsDeleted to determine whether the item has been deleted. The reason that it still keeps the deleted item is so that you can find out what has been deleted and then update your backend data source accordingly.

Thanks!
Basit
Posted: Saturday, September 24, 2011 7:53:05 AM
Rank: Newbie
Groups: Member

Joined: 9/24/2011
Posts: 9
Hi,

What im try to do this in edit mode i deleted the details data from a database and insert it once again.

con.Open()
Dim myreaderq As OleDb.OleDbDataReader
Dim commBal As New OleDb.OleDbCommand("Delete from Trn_QuotTrn where Qt_No=" & Request("Qt_No") & "", con)

myreaderq = commBal.ExecuteReader
con.Close()



con.Open()
Dim Lsm_Qry2 As String
'Dim item As EO.Web.GridItem
'For Each item In Grid1.AddedItems
'For i = 0 To Grid1.RecordCount - 1

Dim i As Integer
For i = 0 To Grid1.RecordCount - 1
Lsm_Qry2 = "Insert into Trn_QuotTrn(Qt_No,Qt_ItmNo,Qt_Qty,Qt_Date) values(?,?,?,?)"
cmd = New OleDb.OleDbCommand(Lsm_Qry2, con)
cmd.CommandType = CommandType.Text

If Grid1.Items(i).Cells(1).Value <> "" Then
cmd.Parameters.AddWithValue("Qt_No", Request("Qt_No"))
cmd.Parameters.AddWithValue("Qt_ItmNo", Grid1.Items(i).Cells(2).Value)
cmd.Parameters.AddWithValue("Qt_Qty", Grid1.Items(i).Cells(3).Value)
cmd.Parameters.AddWithValue("Qt_Date", Convert.ToDateTime(Grid1.Items(i).Cells(4).Value).ToString("dd-MMM-yyyy"))

cmd.ExecuteNonQuery()
End If
Next

con.Close()

But wen i checked in Grid1.recordcount it shows delete item. How i ignore thoes items. Thanks Basit.
eo_support
Posted: Saturday, September 24, 2011 8:00:32 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

I believe my previous reply has already answered your question. You need to check whether an item has been deleted in your loop. It will be something like this:

Code: Visual Basic.NET
If Not Grid1.Items(i).IsDeleted Then
   'Go ahead and do your DB stuff....
   ...
End If


Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.