If Condition For EditCommandColumn

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RN1

    If Condition For EditCommandColumn

    I have a DataGrid with an EditCommandColu mn. 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
    EditCommandColu mn 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 EditCommandColu mn of the DataGrid is clicked. This is
    how I tried it (note that the If condition is in a While loop):

    -----------------------
    Sub Edit_DataGrid(B yVal obj As Object, ByVal ea As
    DataGridCommand EventArgs)
    ..............
    ..............
    While (sqlReader.Read )
    If (condition is False) Then
    dgETS.EditItemI ndex = -1
    Else
    dgETS.EditItemI ndex = ea.Item.ItemInd ex
    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
Working...