Ultrawebgrid template column and row-related operations (formerly)

Source: Internet
Author: User
When using the ultrawebgrid of infragistics netadvantage, you will always encounter problems such as how to select the value of a field of the current row, check the control of the template column, and determine its status. I found related problems on the Internet, and wrote them here.
1. obtain the information of the row selected by ultrawebgrid.
First, set the ultrawebgrid selection status to the row selection mode. Ultrawebgrid1.displaylayout. selecttyperowdefault = Infragistics. webui. ultrawebgrid. selecttype. Single;

then you can obtain the information of the selected row /// the values in the first ultrawebgrid1 column are as follows:
string gridvalue = ultrawebgrid1.displaylayout. selectedrows [ 0 ]. getcellvalue ( This . ultrawebgrid1.columns [ 0 ]). tostring ();

ThisCodeTo obtain the values of a row in a column of any row in ultrawebgrid.//Obtains the value of column 1st of row I.
StringYqbh=Ultrawebgrid1.displaylayout. Rows [I]. getcellvalue (ultrawebgrid1.columns [1]). Tostring ();

2. Set the 0th column of ultrawebgrid as the template column and add the checkbox control to check whether the status is selected. The Code is as follows:

// It can be written anywhere and is a common code.
Infragistics. webui. ultrawebgrid. templatedcolumn tcol =
(Templatedcolumn) ultrawebgrid1.bands [ 0 ]. Columns [ 0 ]; // Template Column
Foreach (Cellitem item In Tcol. cellitems)
{
System. Web. UI. webcontrols. checkbox chkishaveright =
(System. Web. UI. webcontrols. checkbox) item. findcontrol ( " Chbshenhe " );
If (Chkishaveright. Checked = True )
{
//Perform related operations
}
}

Here, we need to consider how to implement cross-row operations on ultrawebgrid. The row values can be calculated and processed according to ultrawebgrid. displaylayout. Pager. pagesize.

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.