RE: How to diable edit mode in the datagrid

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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
.



Relevant Pages

  • Re: About "caching" Re: Ajax Demo
    ... in the first time. ... each master record has about 10 detail records. ... no matter what the data model volumetics ...
    (borland.public.delphi.non-technical)
  • Retrieving Contents of Select List on Form Submit
    ... On an HTML form, I have a select list that is fed dynamically with ... detail records when the master record is displayed on the form. ... array so I can update and add the proper database records. ...
    (comp.lang.php)
  • Re: BIG BUG in Deleting detali records
    ... happen deleting master record does not delete detail records after ... You have to delete the detail records just deleting the master record doesn't ... updatebatch before changing master records all the deletes will be lost. ...
    (borland.public.delphi.database.ado)
  • Print Form/Report with Master and one Detail record per page?
    ... many detail records for each master record. ... page when there are multiple detail records. ... I tried using a report, ...
    (microsoft.public.access.formscoding)