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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Unable to set Text-Property for columns with index greater than 10 (virtual grid)

Thread ID:

Created:

Updated:

Platform:

Replies:

119722 Jul 24,2015 12:53 PM UTC Jul 27,2015 10:04 AM UTC WinForms 1
loading
Tags: GridControl
marcel
Asked On July 24, 2015 12:53 PM UTC

Hey,

i have a little problem with your grid control.
I found this thread (http://www.syncfusion.com/forums/88374/how-to-set-gridcontrol-column-header) and in the last rows you wirte the following snippet:

GridB[0,1].Text="Header1"; // Set the Header text for First header cell
GridB[0,2].Text="Header2";


So i tried this solution and after 5 hours i'm getting headache...
I cannot set the text/value of a header column, if it's index is greater than 10!
I have simplified my test code for you. Please check the comments.

private void SetupHeaderTest()
        {
            //works
            gridControl1[0, 3].Text = "Jul";
           

            //works anyways..
            var blu = gridControl1[0, 8];
            gridControl1[0, 8].Text = "Aug";
            var blu2 = gridControl1[0, 8];

            if (blu.Equals(gridControl1[0, 8]))
            {
                //they are not equals
            }

            if (blu.Equals(blu2))
            {
                //they are not equals
            }

           
            //works...
            var test2 = "Sep";
            var bla = gridControl1[0, 10];
            bla.Text = test2;

            //gridControl1[0, 10] = bla; //works!



            //DO NOT work!
            var test3 = "Sep";
            var bla3 = gridControl1[0, 11]; // if column greater then 10, it do not work!
            bla3.Text = test3;

            //gridControl1[0, 11] = bla3; -->arrayOutOfBounds
        }


Can anyone help me out?

best regards
Marcel Elz

Solai A L [Syncfusion]
Replied On July 27, 2015 10:04 AM UTC

Hi Marcel,

Thank you for your interest in Syncfusion products.

We have analyzed your reported scenario. We would like to let you know that by default virtual grid will contain 5 rows and 10 columns bind initially. Only those cells can be accessed by you initially. If you want to access beyond that you need to use QueryCellInfo event. Using events to access is the appropriate way, else the purpose of using Virtual Grid would be waste. Please refer the below code, sample and KB for clarification.

Code Snippet[c#]:          

void GridQueryCellInfo(object sender, GridQueryCellInfoEventArgs e)

  {

     //Correct usage. Cell values should be accessed only in events for virtual grid.

      if (e.RowIndex == 0 && e.ColIndex == 11)

         {

           var test3 = "Sep";

           var bla3 = e.Style;

           bla3.Text = test3;

           e.Style.Text = bla3.Text;

          }

   }


KB:

https://www.syncfusion.com/kb/427/what-is-a-virtual-grid


Sample :
http://www.syncfusion.com/downloads/support/forum/119722/ze/CS-685379556

Please let us know if you have any other concerns.

Thanks & Regards,
AL.Solai.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;