469,601 Members | 2,344 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,601 developers. It's quick & easy.

Gridview SelectedIndex always one behind

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
1 1639
7,872 Expert 4TB
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.

Similar topics

3 posts views Thread by NateDawg | last post: by
4 posts views Thread by P. Yanzick | last post: by
reply views Thread by ThePurpleCat | last post: by
reply views Thread by Q. John Chen | last post: by
5 posts views Thread by Andrew Robinson | last post: by
3 posts views Thread by Dariusz Tomon | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.