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.
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.