468,249 Members | 1,479 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,249 developers. It's quick & easy.

If Condition For EditCommandColumn

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
Oct 13 '08 #1
0 917

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by RobS | last post: by
1 post views Thread by George Durzi | last post: by
1 post views Thread by angus | last post: by
reply views Thread by tshad | last post: by
reply views Thread by Ian | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.