Ultrawebgrid template column and row-related operations)

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 currently selected row. // the value of the first column of ultrawebgrid1 is as follows:
String gridvalue = ultrawebgrid1.displaylayout. selectedrows [0]. getcellvalue (this. ultrawebgrid1.columns [0]). tostring ();

Inspired by this code, you can obtain the value of a row in a column of any row in ultrawebgrid // obtain the value of column 1st in row I.
String yqbh = 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.