By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,952 Members | 1,785 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,952 IT Pros & Developers. It's quick & easy.

Gridview SelectedIndex always one behind

P: 43
he selectedindex of my gridview is always one behind

for example, if i click on the EDIT.gif on row 1, then 5 , then 7, if i break the code and check the selectedindex, it is equal to 5. if i selected a different row, and then checked the selectedindex again, it would be equal to 7. i've checked a few posts and other people seem to have a problem with the selectedindex being one behind the current selection, anyway i'm stuck :-( here is my code

<asp:GridView ID="gvw" runat="server" AutoGenerateColumns="False" SkinID="MainList" DataKeyNames="ID">
<asp:ImageButton runat="server" ID="Editing" ImageUrl="edit.gif" AlternateText="Edit" CommandName="Editing"
CommandArgument='<%# Eval("ID") %>' />

VB code

If e.CommandName = "Editing" Then



SelectedRow is always lagging one selectedindex behind the current selectedindex, any help would be great :-)
Oct 11 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 5K+
P: 7,872
The selected index for editing probably isn't updated until the "done editing" is fired? Which usually occurs when you click away from the row (i.e. selecting another row)
Oct 11 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.