Hi,
I have a gridview with an UpdateQuery() that's fired when the user
edits/updates a row. The problem lies in the fact that every cell in
the edited row shows up as editable even though one cell actually gets
changed in the database.
Is there a way to make a cell appear non-editable?
Thanks
Sergio E. - 19 Sep 2007 16:46 GMT
set inertvisible=false
> Hi,
>
[quoted text clipped - 6 lines]
>
> Thanks
David Wier - 19 Sep 2007 16:50 GMT
From the Gridview's smart tag, go in and edit the cells - for each column
you do not want editable, make it's property ReadONLY

Signature
David Wier
http://aspnet101.com
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup
> Hi,
>
[quoted text clipped - 6 lines]
>
> Thanks
Monty - 19 Sep 2007 21:02 GMT
If you want more ganular control:
Private Sub grid_RowDataBound(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) _
Handles grdLineItems.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If (e.Row.RowState = DataControlRowState.Edit) Or _
(e.Row.RowState = DataControlRowState.Alternate + _
DataControlRowState.Edit) Then
Dim oTxt As TextBox = e.Row.FindControl("txtFoo")
If oTxt IsNot Nothing Then oTxt.Enabled = False
End If
End If
End Sub
> Hi,
>
[quoted text clipped - 6 lines]
>
> Thanks
Steve Kershaw - 20 Sep 2007 21:23 GMT
> If you want more ganular control:
>
[quoted text clipped - 24 lines]
>
> - Show quoted text -
I tried setting the un-editable columns to ReadOnly="true" but when I
actually update through the ObjectDataSource the editable column isn't
updated. It's acting like it dosen't see the data in the
ReadOnly="true" columns. For example:
UPDATE myTable
SET myEdit = :myEdit
WHERE myNonEdit = :myNonEdit (doesn't see myNonEdit because of the
ReadOnly="true")
AND...
Note the ":" instead of the "@" because this is an Oracle (not SQL
Server) database.
Thanks so much for your help!
Steve