HighTechTalks DotNet Forums  

FormView not displaying the correct templates

Dotnet Framework (ADO.net) microsoft.public.dotnet.framework.adonet


Discuss FormView not displaying the correct templates in the Dotnet Framework (ADO.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Nathan Sokalski
 
Posts: n/a

Default FormView not displaying the correct templates - 08-26-2007 , 05:26 PM






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
njsokalski (AT) hotmail (DOT) com
http://www.nathansokalski.com/



Reply With Quote
Reply




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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.