R
RN1
I have a DataGrid with an EditCommandColumn. In the EditCommand sub of
the DataGrid, there is an If condition. This If condition is True for
some rows in the DataGrid whereas it is False for the other rows in
the DataGrid. I want that only those rows whose If condition evaluates
to True should go into the editable mode when the Edit link in the
EditCommandColumn is clicked where as the rows whose If condition
evaluates to False shouldn't go into the editable mode even when the
Edit link in the EditCommandColumn of the DataGrid is clicked. This is
how I tried it (note that the If condition is in a While loop):
-----------------------
Sub Edit_DataGrid(ByVal obj As Object, ByVal ea As
DataGridCommandEventArgs)
..............
..............
While (sqlReader.Read)
If (condition is False) Then
dgETS.EditItemIndex = -1
Else
dgETS.EditItemIndex = ea.Item.ItemIndex
End If
End While
dgETS.DataBind()
End Sub
-----------------------
But the rows who satisfy the If condition never get into the editable
mode when the Edit link is clicked.
Where am I erring? Can someone please help me out with this & give me
some suggestions on how to go about it?
Please note that the If condition compares a part of a column (all the
columns in the DataGrid are being retrieved from a SQL Server DB
table) with a number.
Thanks,
Ron
the DataGrid, there is an If condition. This If condition is True for
some rows in the DataGrid whereas it is False for the other rows in
the DataGrid. I want that only those rows whose If condition evaluates
to True should go into the editable mode when the Edit link in the
EditCommandColumn is clicked where as the rows whose If condition
evaluates to False shouldn't go into the editable mode even when the
Edit link in the EditCommandColumn of the DataGrid is clicked. This is
how I tried it (note that the If condition is in a While loop):
-----------------------
Sub Edit_DataGrid(ByVal obj As Object, ByVal ea As
DataGridCommandEventArgs)
..............
..............
While (sqlReader.Read)
If (condition is False) Then
dgETS.EditItemIndex = -1
Else
dgETS.EditItemIndex = ea.Item.ItemIndex
End If
End While
dgETS.DataBind()
End Sub
-----------------------
But the rows who satisfy the If condition never get into the editable
mode when the Edit link is clicked.
Where am I erring? Can someone please help me out with this & give me
some suggestions on how to go about it?
Please note that the If condition compares a part of a column (all the
columns in the DataGrid are being retrieved from a SQL Server DB
table) with a number.
Thanks,
Ron