We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Verify the column value in all Rows

Team,
 
We are doing test automation for an application using syncfusion grid.. We have access to grid object.. we need to verify a whether same value is there in a column of a grid.. Is there anyway to do that ? I think iterating through all rows and verifying is not a good idea.
 
Kindly help us
 
Regards,
Srini

3 Replies

MK Muthukumar Kalyanasundaram Syncfusion Team November 17, 2014 12:47 PM UTC

Hi Srinivasan,

 

Thank you for your interest in Syncfusion product.

 

If you want to verify the same value is there in a column of all rows in a grid. We have customized the sample as per your need. Please refer the below attached sample.

 

Regards,

Muthukumar K


Attachment: Sample_d82e2336.zip


SR Srinivasan November 18, 2014 04:58 AM UTC

Thank you Muthu kumar for your reply..
 
My requirement to identify whether same value is there  in entire column ... So most common approach would be to iterate
 
text="110"
columnIndex=3;
for(i=0;i<rowcount;i++){
if(!(grid.get_Item(i,columnIndex)==text))
Log.Error("Invalid value in column")
}
 
The above code will work , but its inefficient code... As we have to iterate through all rows and it will be perfomance hit if we more number of rows ...
 
So my real question is
 
1) Is there any method in sync fusion grid object , that will give all cell values(in all rows) of a column seperated by delimiter...? If not pls suggest me efficient way to get all column values..
 
2) Is there any method in syncfusion grid object, that give all column values of a row seperated by delimitter?... if not pls suggest me efficient way ?
 
Regards,
Srini
 
 


MK Muthukumar Kalyanasundaram Syncfusion Team November 25, 2014 01:52 AM UTC

Hi Sirnivasan,

 

Sorry for the delay in response.

 

If you want to identify whether the same value is occurred on particular column (column as 3) or not, you can use the “Contains” method. And also if you want to separate the delimiter in the grid cellvalue, you can use “Replace” method. Please refer the below code,

 

Code:

      string myArray;

        private void button1_Click(object sender, EventArgs e)

        {          

            if (checkBox1.CheckState == CheckState.Checked)

            {

                string s = cmbSearch.Text;

                myArray = s.Replace(",", "").Replace(".","").Replace(" ","");             

                highlighttext.HighlightText = myArray.ToString();

                this.gridControl1.Refresh();

            }

            for (int k = 1; k < this.gridControl1.RowCount; k++)

            {

                if (this.gridControl1[k, 2].Text.Contains(myArray))

                {

                    this.gridControl1[k, 2].BackColor = Color.DeepSkyBlue; 

                }

                else

                {

                    this.gridControl1[k, 2].BackColor = Color.White;

                }

            }          

        }

 

Please let us know if I misunderstood your query.

 

Regards,

Muthukumar K


Attachment: Sample_a7702418.zip

Loader.
Live Chat Icon For mobile
Up arrow icon