OnItemCommand

J

Jim in Arizona

I've found that the datalist parameter OnItemCommand will fire
regardless of what button (or link) you press within a datalist item,
even if that button is already referred to one of the other Command
events (OnEditCommand, OnCancelCommand, OnUpdateCommand, and
OnDeleteCommand).

I was hoping to be able to add a half dozen or so buttons on each
datalist item that is displayed, but the only options available are the
OnEditCommand, OnCancelCommand, OnUpdateCommand, and OnDeleteCommand.
That's only four commandbuttons I can place on each datalist item.

Is there another way I can add more buttons that will refer back to the
datakeyfield using the DataListCommandEventArgs?

Note that I already asked about this topic earlier today, but I've found
that if my posts are long winded, most people will just keep walking.
 
C

Cowboy \(Gregory A. Beamer\)

Off of the event args you can get the item in question. For example, while
not exactly as you are aiming for, we use RowCommand event and get
e.CommandName. This will determine what command we are running. It is a bit
more difficult when you try to overload past the commands available,
however. In those cases, using a template and include a linkButton (as an
example). You can then determine what sender is and work from there. There
are really quite a few ways to tackle this creature.

The main thing to remember is watch what you are doing in standard events
and make sure you exclude your new commands if they fire events. By running
through different command arguments, or figuring sender, you can get through
this.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
 
J

Jim in Arizona

Cowboy said:
Off of the event args you can get the item in question. For example, while
not exactly as you are aiming for, we use RowCommand event and get
e.CommandName. This will determine what command we are running. It is a bit
more difficult when you try to overload past the commands available,
however. In those cases, using a template and include a linkButton (as an
example). You can then determine what sender is and work from there. There
are really quite a few ways to tackle this creature.

The main thing to remember is watch what you are doing in standard events
and make sure you exclude your new commands if they fire events. By running
through different command arguments, or figuring sender, you can get through
this.

Could you give me an example of using the RowCommand event? I'm not sure
I'm following you. I'll do some more experimentation tomorrow when I get
back to work and see if I can grasp the concept you're trying to put
across. Thanks Gregory.
 

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,772
Messages
2,569,593
Members
45,111
Latest member
KetoBurn
Top