471,086 Members | 1,137 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,086 software developers and data experts.

How to diable edit mode in the datagrid

I have a datagrid that allows users to eidt/update detail records. The grid
shows detail records for a master record. Once the status of the master
record changes to "closed", I need to ensure that the users can't update the
detail records. The easiest way to do this may be to disable the edit button
on the detail grid.

How can I dynamically disable the edit mode for the entire datagrid based on
status of the master record or is there a better alternative?

Thank you
Nov 19 '05 #1
2 2341
One way to do it, would be on the ItemDataBound event, where you could
disable the edit button as you said.

Not sure about doing it for a whole grid at once though.

"Mardy" <Ma***@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com...
I have a datagrid that allows users to eidt/update detail records. The grid
shows detail records for a master record. Once the status of the master
record changes to "closed", I need to ensure that the users can't update
the
detail records. The easiest way to do this may be to disable the edit
button
on the detail grid.

How can I dynamically disable the edit mode for the entire datagrid based
on
status of the master record or is there a better alternative?

Thank you

Nov 19 '05 #2
I found this solution and it works pretty well..just thought I'd pass it along

<asp:DataGrid id="DataGrid1" runat="server">
<Columns>
<asp:TemplateColumn HeaderText ="Product Information" >
<ItemTemplate >
<asp:Button CommandName="Status" Text ="Status" Runat =server
Enabled
=<%#CheckStatus(Convert.ToBoolean(DataBinder.Eval( Container.DataItem,"AuditStatusID")))%> ID="Button1" >
</asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
VB.NET

Protected Function CheckStatus(ByVal StatusID As Boolean) As Boolean
If StatusID = 1 or StatusID = 2 Then
Return True
Else
Return False
End If
End Function


"Mardy" wrote:
I have a datagrid that allows users to eidt/update detail records. The grid
shows detail records for a master record. Once the status of the master
record changes to "closed", I need to ensure that the users can't update the
detail records. The easiest way to do this may be to disable the edit button
on the detail grid.

How can I dynamically disable the edit mode for the entire datagrid based on
status of the master record or is there a better alternative?

Thank you

Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Tamir Khason | last post: by
3 posts views Thread by Leo | last post: by
3 posts views Thread by Tim::.. | last post: by
1 post views Thread by David Sagenaut | last post: by
4 posts views Thread by wandii | last post: by
9 posts views Thread by rn5a | last post: by
8 posts views Thread by =?Utf-8?B?bWlrZWc=?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.