ASP 1.1: DataGrid - Showing/Not Showing Buttons

Discussion in 'ASP .Net' started by Ray Booysen, Mar 28, 2006.

  1. Ray Booysen

    Ray Booysen Guest

    Hi all

    I have a collection of Invoices that I bind to a datagrid. Some of
    these invoices have been processed and you can tell this via a property
    in the invoice class called DateProcessed. If an invoice has been
    processed I do not want a button to display for this invoice but all
    other unprocessed invoices need the button to be displayed.

    Any ideas?

    Regards
    Ray
    Ray Booysen, Mar 28, 2006
    #1
    1. Advertising

  2. Ray Booysen

    Ray Booysen Guest

    Ray Booysen wrote:
    > Hi all
    >
    > I have a collection of Invoices that I bind to a datagrid. Some of
    > these invoices have been processed and you can tell this via a property
    > in the invoice class called DateProcessed. If an invoice has been
    > processed I do not want a button to display for this invoice but all
    > other unprocessed invoices need the button to be displayed.
    >
    > Any ideas?
    >
    > Regards
    > Ray

    Here is the datagrid:

    > <asp:datagrid id="grdInvoices" runat="server" CssClass="StandardGrid" ItemStyle-CssClass="Normal"
    > DataKeyField="ID" AutoGenerateColumns="False" CellPadding="5" AllowPaging="True" PageSize="10"
    > HeaderStyle-CssClass="SubHead">
    > <HeaderStyle CssClass="SubHead"></HeaderStyle>
    > <Columns>
    > <asp:BoundColumn DataField="InvNum" HeaderText="Invoice Number">
    > <ItemStyle Width="50px" CssClass="Normal"></ItemStyle>
    > </asp:BoundColumn>
    > <asp:BoundColumn DataField="Description" HeaderText="Description">
    > <ItemStyle CssClass="Normal"></ItemStyle>
    > </asp:BoundColumn>
    > <asp:BoundColumn DataField="AgentName" HeaderText="Client">
    > <ItemStyle Width="100px" CssClass="Normal"></ItemStyle>
    > </asp:BoundColumn>
    > <asp:BoundColumn DataField="WEDate" HeaderText="Week Ending" DataFormatString="{0:dd/MM/yyyy}">
    > <ItemStyle CssClass="Normal"></ItemStyle>
    > </asp:BoundColumn>
    > <asp:BoundColumn DataField="Amount" HeaderText="Amount">
    > <ItemStyle Width="80px" CssClass="Normal"></ItemStyle>
    > </asp:BoundColumn>
    > <asp:BoundColumn DataField="VAT" HeaderText="VAT">
    > <ItemStyle Width="80px" CssClass="Normal"></ItemStyle>
    > </asp:BoundColumn>
    > <asp:BoundColumn DataField="Received" HeaderText="Received">
    > <ItemStyle CssClass="Normal"></ItemStyle>
    > </asp:BoundColumn>
    > <asp:ButtonColumn Text="edit" CommandName="Edit">
    > <ItemStyle HorizontalAlign="Center" Width="50px" CssClass="CommandButton"></ItemStyle>
    > </asp:ButtonColumn>
    > <asp:ButtonColumn Text="delete" CommandName="Delete">
    > <ItemStyle HorizontalAlign="Center" Width="50px" CssClass="CommandButton"></ItemStyle>
    > </asp:ButtonColumn>
    > <asp:ButtonColumn Text="submit" CommandName="Close">
    > <ItemStyle HorizontalAlign="Center" Width="50px" CssClass="CommandButton"></ItemStyle>
    > </asp:ButtonColumn>
    > </Columns>
    > <PagerStyle HorizontalAlign="Center" CssClass="SubHead" Mode="NumericPages"></PagerStyle>
    > </asp:datagrid>
    Ray Booysen, Mar 28, 2006
    #2
    1. Advertising

  3. Ray Booysen

    Ray Booysen Guest

    Ray Booysen wrote:
    > Hi all
    >
    > I have a collection of Invoices that I bind to a datagrid. Some of
    > these invoices have been processed and you can tell this via a property
    > in the invoice class called DateProcessed. If an invoice has been
    > processed I do not want a button to display for this invoice but all
    > other unprocessed invoices need the button to be displayed.
    >
    > Any ideas?
    >
    > Regards
    > Ray

    OK, don't worry about it. I can check this via the ItemDataBound()
    event and disable the relevant row's cells from there.

    I can retrieve the invoice I require from the e.Item.DataItem property.

    Thanks!
    Ray Booysen, Mar 28, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Darren D'Orlando
    Replies:
    1
    Views:
    720
    Steve C. Orr, MCSD
    Aug 19, 2003
  2. Lars Netzel

    My Buttons and controls are not showing???

    Lars Netzel, Aug 5, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    378
    Mark Rae
    Aug 5, 2004
  3. =?Utf-8?B?QmVu?=

    Image Buttons/Buttons not responding

    =?Utf-8?B?QmVu?=, Jul 6, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    432
    Teemu Keiski
    Jul 6, 2005
  4. Jeremy Jones

    Datagrid Nav buttons and numeric buttons

    Jeremy Jones, Mar 21, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    601
    Masudur
    Mar 22, 2007
  5. nib

    Problem with Update & Cancel buttons not showing up

    nib, Nov 19, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    131
    Aneesh
    Nov 25, 2003
Loading...

Share This Page