SelectedIndex changed after onclick event

C

Cathryn Johns

Hi

I have a datagrid, with a column containing an edit button for each row
(using a template column):
<asp:TemplateColumn>
<ItemTemplate>
<asp:button id="editButton" runat="server" Text="Edit"
CommandName="Select" OnClick="EditClick"></asp:button>
</ItemTemplate>
</asp:TemplateColumn>

The idea is that the user clicks the edit button, and I then get the
selected index, from that get the id of the row, and send it off
somewhere else to be processed.

But I find that the SelectedIndex property (and the
selectedIndexChanged event) is only changed *after* the onclick method
is called! Is there any way to reverse this order? I guess that I
could just forget the onclick method and do everything that I need to
in the SelectedIndexChanged event handler, but that seems a bit kludgy.
 

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,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top