Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 4th, 2003, 08:38 AM
Registered User
Join Date: Jun 2003
Location: Galveston, TX, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Hidden template buttons

I'm using the datagrid and template approach to edit and add new records to a database. After selecting criteria, I present the datagrid template with Edit and Delete buttons. Upon clicking an Add New Record button, I want to make the template footer visible where the person can add a new record.

My problem is that I also want to make the Edit and Delete buttons invisible during this time of adding a new record.

Here's my button which starts the add process:

     Text="Add new record"

Here's the template columns where the buttons are defined:

          <asp:TemplateColumn HeaderText="">
              <asp:Button id="btnEdit" CommandName="Edit" Text=" Edit " Size="12"
                   BackColor="#79C4DD" runat="server"/>
              <asp:Button CommandName="Cancel" Text="Cancel" Size="6"
                   BackColor="#79C4DD" runat="server"/>
              <asp:Button CommandName="Update" Text="Update" Size="6"
                   BackColor="#79C4DD" runat="server"/>
               <asp:Button CommandName="Insert" Text="Add" ID="cmdAdd" Size=12"
                   BackColor="#79C4DD" runat="server"/>

          <asp:TemplateColumn HeaderText="">
              <asp:Button id="btnDelete" CommandName="Delete" Text="Delete" Size="12"
                   BackColor="#79C4DD" runat="server"/>
               <asp:Button CommandName="CancelInsert" Text="CancelAdd" ID="cmdCancelAdd" Size=12"
                   BackColor="#79C4DD" runat="server"/>

Here's my button logic:

  Sub ShowAdd(Sender As Object, E As DataGridCommandEventArgs)

    dgSelTuition.ShowFooter = True

    Dim item as DataGridItem
    For each Item in dgSelTuition.Items
      E.item.findcontrol("btnEdit").Visible = False
      E.item.findcontrol("btnDelete").Visible = False
    Next item


  End Sub

I get the error message:

BC30408: Method 'Public Sub ShowAdd(Sender As Object, E As System.Web.UI.WebControls.DataGridCommandEventArgs )' does not have the same signature as delegate 'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'.

Any advice?
  #2 (permalink)  
Old June 5th, 2003, 09:52 AM
Authorized User
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 15
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to james_sellwood

The error message you are getting I think is due to the fact that you are declaring the subprocedure using:

Sub ShowAdd(Sender As Object, E As DataGridCommandEventArgs)
The button that is calling this function is not part of the datagrid and so is unable to provide DataGridCommandEventArgs. You need to reword the declaration to:

Sub ShowAdd(Sender As Object, E As System.EventArgs)

:) James Sellwood :)

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
paging enabled but hidden buttons DarkForce ASP.NET 2.0 Basics 1 July 27th, 2007 02:52 AM
How to modify hidden value? Edward King Javascript 2 January 21st, 2006 05:44 AM
calling one template in other template VijayKumar XSLT 3 September 15th, 2005 11:12 AM
Buttons in DataGrid Template Column divsalar ASP.NET 1.x and 2.0 Application Design 1 February 1st, 2005 03:37 PM
Hidden form value johnjohn Classic ASP Databases 2 November 10th, 2004 01:00 PM

All times are GMT -4. The time now is 09:28 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.