SelectedIndex changed after onclick event

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default SelectedIndex changed after onclick event

    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.

    Cathryn Johns Guest

  2. Similar Questions and Discussions

    1. are there any event handlers besides onClick?
      hi, i've made a command for my extension which is called by a menuitem in the File menu via dw.runCommand("myCommand.html"); this .html is...
    2. Onclick event
      I would like for certain Contribute users to be able to add on onclick event on links. How can they do this ? Thanks!
    3. onclick event not working
      Hi there I have created a button on a web page and placed text over the button. I have tried a few things to get the button working so that...
    4. Listbox selectedindex changed event not firing from within datagrid
      Hi Jason, Thank you for posting in the community! Based on my understanding, you use ListBox in your DataGrid EditTemplate. Although you have...
    5. script ASP in an onClick event
      i need to insert, in a onClick event of a submit button in a form, a call to an ASP script, like follows: <INPUT TYPE="SUBMIT" NAME="btnSend"...
  3. #2

    Default Re: SelectedIndex changed after onclick event

    Same issue!!
    Nda Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139