DataList - How Does It Know

J

Jim Heavey

I have a datalist control and when edit mode, I have three buttons, one for
delete, one for cancel and one for Update. My Update button is not causing
anything to happen. The other two events work just fine.

I thought the way in knows which event to fire is by the "CommandName"

My button looks like the following:
<asp:Button CommandName="Update" Text="Update Highlights" Runat="server"
ID="cmdUpdateHighlights" CausesValidation="True"></asp:Button>

My OnUpdateCommand in the Datalist Attribute looks like this...
OnUpdateCommand="ProcessHighlightUpdateCommand"

SO is it not true that if my command name is "Update" that run
"ProcessHighlightUpdateCommand"?

It seems to work on the other buttons, but why not Update?

Thanks in advance for your assistance!!!!
 
R

Rick Spiewak

Try doing this in a more straightforward manner. Instead of declaring your
own names for the events, use the built-in ones - EditCommand,
DeleteCommand, UpdateCommand. Leave ItemCommand for any other stray commands
you might need.

The reason your event isn't firing is that it is wired to UpdateCommand,
where the command you are actually using is Update. You could catch this in
the ItemCommand event, but I recommend just using the standard handlers.
 
J

Jim Heavey

The problem turn out to be the Validation controls. I did not place an
error message on the controls, and so they were detecting errors at the
client and never doing a post back because the page did not pass local
validation. It really looks like you button is dead when you forget to
provide an error message on validation controls.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,097
Latest member
RayE496148

Latest Threads

Top