Extend the GridView Control

Source: Internet
Author: User
The GridView is powerful and easy to use. To make it more powerful and easy to use, we can write a control that inherits from the GridView.
[Download source code]

Extend the GridView Control

Control Development
Extend the GridView Control (1) -- change the row style when the mouse goes through a row

Extend the GridView Control (2) -- add the sorting status to the field title

Extended GridView control (3) -- click the command button to bring up a confirmation box

Extend the GridView control (4) -- select all and deselect all check boxes for each row

Extend the GridView control (5)-fixed the header, specified rows, or specified Columns

Extended GridView control (6) -- Response to the mouse click and double-click event of data rows

Extend the GridView control (7) -- change the style of the row selected through the CheckBox

Extended GridView control (8) -- export to Excel

Extend the GridView control (9) -- add a right-click menu to the data row

Extend the GridView control (10) -- add a paging Style

Widget

Control usage
1. Change the line style when the mouse goes through the line
CssClassMouseOver-CSS Class Name of the style with the mouse passing through the row

2. Add the sorting status to the field title
Set the four attributes of SortTip.
SortAscImage-image in ascending order
SortAscText-Prompt text in ascending order
SortDescImage-displays images in descending order
SortDescText-Prompt text in descending order

3. Click the command button to bring up the confirmation box.
Set its ConfirmButtons attribute
CommandName-CommandName attribute of the command button
ConfirmMessage-text displayed in the pop-up confirmation box

4. Select All and cancel all check boxes for each row
Add a check box to the header template of the template column, add a check box to the item template of the template column, and set the control's checkboxils attribute.
CheckboxAllID-check box ID for all template Columns
CheckboxItemID-template column check box ID

5. Fixed the header, specified row, or specified Column
Set six attributes under its FixRowCol
IsFixHeader-Fixed Header?
IsFixPager-fixed paging rows?
FixRowIndices-index of rows to be fixed (separated by commas)
FixColumnIndices-index of the columns to be fixed (separated by commas)
TableWidth-table width
TableHeight-table height
EnableScrollState-whether to keep the scroll bar status

6. data rows respond to the mouse click and double-click events
RowClickButtonID-row click the ID of the button corresponding to the event
RowDoubleClickButtonID-ID of the button corresponding to the row double-click event

7. Change the row style selected through the CheckBox
CheckBoxID-ID of the checkbox of the template Column
CssClassRowSelected-CSS Class Name of the selected row style

8. Export to Excel
Add a button in the GridView
Set the CommandName attribute to "ExportToExcel"
The value of the CommandArgument attribute is separated by a comma (;). The left part is the name of the exported Excel file, and the right part is the index of the column to be hidden. "Separate)

9. Right-click the data row
ItemType-context menu item category (Link, Command, Separator)
Icon-link of the Icon on the left of the text
Text-menu Text
CommandButtonId-ID of the called command button
NavigateUrl-link url
Target-target (Blank, Self, Top) of The Link)

10. Add a paging style.
Set the PagingStyle attribute to Default.
Set the original PageButtonCount, FirstPageText, PreviousPageText, NextPageText, LastPageText, FirstPageImageUrl, PreviousPageImageUrl, NextPageImageUrl, LastPageImageUrl

OK
[Download source code]

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.