GridView cause postback and raise an event

A

AAaron123

With a GridView control when user double clicks an item it becomes
highlighted.

I would like that to cause a postback with a raised event.

The best I can determine that is not possible.

Am I correct?


Thanks
 
G

George

Everything possible, depends how much money you have :)

You can always "invent" an event if one is missing.
See GridView.RowCommand Event

George.
 
S

Stan

With a GridView control when user double clicks an item it becomes
highlighted.

I would like that to cause a postback with a raised event.

The best I can determine that is not possible.

Am I correct?

Thanks

Hi

With gridview there is an option for a "select" command button to be
placed in an additional column. This will raise a SelectedIndexChange
event. It has limited use because it only tells you the index of the
row that is selected.

As George suggested, a better alternative is to create a template
column and put a button or linkbutton there. Use the command name
property to indicate that the button has been clicked and the
CommandArgument to indicate the data key of the row that is clicked.
To do this bind the CommandArgument to the datasource.

When the button is clicked it will raise the RowCommand event and the
EventArgument parameter e will contain the CommandName and
CommandArgument, from which you can write code to detect and respond
accordingly.
 
A

AAaron123

Thanks


George said:
Everything possible, depends how much money you have :)

You can always "invent" an event if one is missing.
See GridView.RowCommand Event

George.
 
A

AAaron123

Thanks for all the info. I'll try that.

Stan said:
Hi

With gridview there is an option for a "select" command button to be
placed in an additional column. This will raise a SelectedIndexChange
event. It has limited use because it only tells you the index of the
row that is selected.

As George suggested, a better alternative is to create a template
column and put a button or linkbutton there. Use the command name
property to indicate that the button has been clicked and the
CommandArgument to indicate the data key of the row that is clicked.
To do this bind the CommandArgument to the datasource.

When the button is clicked it will raise the RowCommand event and the
EventArgument parameter e will contain the CommandName and
CommandArgument, from which you can write code to detect and respond
accordingly.
 

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,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top