The sub-control iterator in the gridview obtains the gridviewrow and rowindex of the vertex.

Source: Internet
Author: User
False settings place the checkbox control variable in the itemtemplate of the girdview, and then set the autopostback of the checkbox to true. You want to write the related program variable in the checkedchanged event of the checkbox.
* The aspx program example is as follows:

< Edititemtemplate >
< ASP: checkbox ID = "Checkbox1" Runat = "Server" Autopostback = "True" Checked = '<% # BIND ("discontinued") % > '
Oncheckedchanged = "checkbox#checkedchanged"/>
</ Edititemtemplate >

Generally, the checkedchanged event in the checkbox requires that it is the PostBack initiated by the checkbox of the item column. You can compile the following program to obtain the gridviewrow and rowindex that control the cursor.

1 Protected   Sub Checkbox#checkedchanged ( Byval Sender As   Object , Byval E As System. eventargs)
2 Dim Ocheckbox As Checkbox
3 Dim Ogridviewrow As Gridviewrow
4 Dim Irowindex As   Integer
5
6 Ocheckbox =   Ctype (Sender, checkbox)
7
8 ' Obtain the attention gridviewrow of the control worker.
9 Ogridviewrow =   Ctype (Ocheckbox. bindingcontainer, gridviewrow)
10
11 ' Obtain the index of the current gridviewrow
12 Irowindex = Ogridviewrow. rowindex
13 End sub

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.