User-72198832 posted
I have a DataTable with two DataRows
Un-Edited Rows
Index Description Control
0 Red Box P
1 Blue Shoes P
Here's how I get RowIndex
Protected Sub Partsview1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles PartsView1.RowCommand
Dim currentRowIndex As Integer = Int32.Parse(e.CommandArgument.ToString())
I want to Hide a DataRow so I store a "D" in the Control Column
dtParts.Rows(currentRowIndex)("Control") = "D"
I also use a RowFilter to hide all rows with"D" in Control field
Dim dv As New DataView(dtParts)
dv.RowFilter = "Control <> 'D'"
PartsView1.DataSource = dv
PartsView1.DataBind()
If I first hide rowindex 1 using code below row is hidden properly
dtParts.Rows(currentRowIndex)("Control") = "D"
If I then hide rowindex 0 it too is hidden
My rows
Index Description Control
0 Red Box D
1 Blue Shoes D
All is OK at this point.
Now Repeating this Process Using UnEdited Data from top of this post
Here is problem...
Hide Row 0 first Then Hide remaining visible row
Data table is then
Index Description Control
0 Red Box D
1 Blue Shoes P
Row does not get hidden because Im trying to hide Index 1 but since it's the only displayed row Im overwriting Control field in Index 0 with "D"
After Hiding the Red Box row Blue Shoes moves into
displayed row index position 0 but in reality it's still in table as row 1
How do I Update a table row if I can't get proper Row Index?
Any help is appreciated
LB