J
Jim Heavey
I have 2 datalist each has 3 buttons in the datalist.
One Datalist, only 2 of the three buttons work in the other one is dead
(no postback, not nothing).
I have another Datalist and on this one, all three buttons are dead (not
postback, not nothing).
To get a button to work on the DataList...here are the rules that I know
of
1. Specify the appropriate "On..." Event attribute when defining the
DataList object. So if you intend to use the "Delete" Command Button,
you must have specified the "OnDeleteCommand" with some method which is
set up to handle the event... "OnDeleteCommand=DoItemDelete".
2. When creating the button in the "EditItemTemplate", you must specify
provide the "CommandName" attribute of the button, and this name must be
"Update" or "Cancel" or "Delete". The command must have the
"Runat='Server' specified as well
SO what am I missing to get these buttons to work?
Here is some code....
<asp:datalist id="dlPPIP" runat="server"
OnItemCommand="PPIP_Process_OnItem"
OnCancelCommand="PPIP_Process_Cancel"
OnDeleteCommand="PPIP_Process_Delete"
OnUpdateCommand="PPIP_Process_Update" DataKeyField="PPIP_ID"
EditItemStyle-BackColor="Yellow" EditItemStyle-ForeColor="black"
OnEditCommand="PPIP_Process_Edit" GridLines="Both">
NONE OF THESE BUTTONS FUNCTION (CAUSE A POSTBACK)
<asp:Button ID="cmdPPIPEditUpdate" CommandName="Update" Text="Update"
Runat="server" CausesValidation="True"></asp:Button>
<asp:Button ID="cmdPPIPEditCancel" CommandName="Cancel" Text="Cancel"
Runat="server" CausesValidation="True"></asp:Button>
<asp:Button ID="cmdPPIPEditDelete" CommandName="Delete" Text="Delete"
Runat="server" BackColor="red" ForeColor="white" Font-Bold="True"
CausesValidation="False"></asp:Button>
If you remove the method for "Update", the error is caught when the form
is attempting to display, so the system is definitely looking for the
form, but it is not wiring the button to the event...what can I
check/change to get this to work?
One Datalist, only 2 of the three buttons work in the other one is dead
(no postback, not nothing).
I have another Datalist and on this one, all three buttons are dead (not
postback, not nothing).
To get a button to work on the DataList...here are the rules that I know
of
1. Specify the appropriate "On..." Event attribute when defining the
DataList object. So if you intend to use the "Delete" Command Button,
you must have specified the "OnDeleteCommand" with some method which is
set up to handle the event... "OnDeleteCommand=DoItemDelete".
2. When creating the button in the "EditItemTemplate", you must specify
provide the "CommandName" attribute of the button, and this name must be
"Update" or "Cancel" or "Delete". The command must have the
"Runat='Server' specified as well
SO what am I missing to get these buttons to work?
Here is some code....
<asp:datalist id="dlPPIP" runat="server"
OnItemCommand="PPIP_Process_OnItem"
OnCancelCommand="PPIP_Process_Cancel"
OnDeleteCommand="PPIP_Process_Delete"
OnUpdateCommand="PPIP_Process_Update" DataKeyField="PPIP_ID"
EditItemStyle-BackColor="Yellow" EditItemStyle-ForeColor="black"
OnEditCommand="PPIP_Process_Edit" GridLines="Both">
NONE OF THESE BUTTONS FUNCTION (CAUSE A POSTBACK)
<asp:Button ID="cmdPPIPEditUpdate" CommandName="Update" Text="Update"
Runat="server" CausesValidation="True"></asp:Button>
<asp:Button ID="cmdPPIPEditCancel" CommandName="Cancel" Text="Cancel"
Runat="server" CausesValidation="True"></asp:Button>
<asp:Button ID="cmdPPIPEditDelete" CommandName="Delete" Text="Delete"
Runat="server" BackColor="red" ForeColor="white" Font-Bold="True"
CausesValidation="False"></asp:Button>
If you remove the method for "Update", the error is caught when the form
is attempting to display, so the system is definitely looking for the
form, but it is not wiring the button to the event...what can I
check/change to get this to work?