FormView not displaying the correct templates

Discussion in 'ASP .Net Web Controls' started by Nathan Sokalski, Aug 26, 2007.

  1. I have a FormView control with the following templates:

    EmptyDataTemplate
    ItemTemplate
    EditItemTemplate
    InsertItemTemplate

    I am not using Paging, because the FormView is simply being used to display
    the fields from a database. The user selects the record using a ListBox (I
    am not using Paging because I want to allow the user to select the record
    through scrolling). I have managed to get the FormView to display the data
    for the selected record when the user selects a different item in the
    ListBox, but the buttons that I have in the templates do not seem to be
    working.

    <asp:Button ID="btnAdd" runat="server" Text="Add New Record"
    CommandName="new"/>
    <asp:Button ID="btnDelete" runat="server" Text="Delete Selected Item"
    CommandName="delete"/>
    <asp:Button ID="btnEdit" runat="server" Text="Edit Record"
    CommandName="edit"/>

    The buttons do not even seem to be triggering the events, such as
    ItemInserting. When I tried using LinkButtons instead with the same
    CommandName attributes, it triggered the ItemCommand and ModeChanging events
    (There is currently no code in these events). Why won't the FormView let me
    go to the EditItemTemplate and InsertItemTemplate? Is there something I need
    to do in the ItemCommand or ModeChanging events? Also, although not my top
    priority right now, why is the LinkButton working but not the Button, they
    both have a CommandName property and inherit and implement the same classes
    and interfaces? If someone can please help me here, I would appreciate it.
    Thanks.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/
    Nathan Sokalski, Aug 26, 2007
    #1
    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. Dan

    correct or not correct?

    Dan, Oct 2, 2003, in forum: HTML
    Replies:
    7
    Views:
    430
  2. JKop
    Replies:
    3
    Views:
    451
  3. recover
    Replies:
    2
    Views:
    784
    recover
    Jul 25, 2006
  4. Nathan Sokalski

    FormView not displaying the correct templates

    Nathan Sokalski, Aug 26, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    1,417
    Nathan Sokalski
    Aug 26, 2007
  5. bogdan
    Replies:
    0
    Views:
    388
    bogdan
    Apr 10, 2008
Loading...

Share This Page