How do I get the Clicked Event on Hyperlink to execute a Command?

P

Paul D. Fox

I have a ButtonColumn as a link. When the user clicks on it, I want to execute a command to query a database and display data in another grid. I need to get the key and pass it to the query.

Here's part of the DataGrid HTML:

<asp:ButtonColumn Text="Select" DataTextField="Schedule" HeaderText="Training Dates" CommandName="Select"></asp:ButtonColumn>

How do I call an Event, get the primary key ( I guess its the DataKeyField) and run another query?
 
P

Paul D. Fox

Nevermind, I solved it. I used the ItemCommand Event to get
datagrid1.DataKeys(e.Item.ItemIndex)

I have a ButtonColumn as a link. When the user clicks on it, I want to execute a command to query a database and display data in another grid. I need to get the key and pass it to the query.

Here's part of the DataGrid HTML:

<asp:ButtonColumn Text="Select" DataTextField="Schedule" HeaderText="Training Dates" CommandName="Select"></asp:ButtonColumn>

How do I call an Event, get the primary key ( I guess its the DataKeyField) and run another query?
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top