If Condition For EditCommandColumn

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top