Rad Grid event event output

Can someone tell me what is happening in this section? Why does this make the elements invisible?

protected void rgStateTax_PreRender( object sender, EventArgs e )
    {
        if( rgStateTax.MasterTableView.IsItemInserted )
        {
            foreach( GridItem item in rgStateTax.Items )
            {
                item.Visible = false;
            }
        }

        if( rgStateTax.EditItems.Count > 0 )
        {
            foreach( GridDataItem item in rgStateTax.Items )
            {
                if( item != rgStateTax.EditItems[0] )
                {
                    item.Visible = false;
                }
            }
        }
    }

here rgStateTax is the radar grid, and PreRender is the event before the page actually appears on the screen, right?

+3
source share
2 answers

Yes, PreRender is called before the control for the page is displayed.

This piece of code simply iterates over almost every element in the grid and makes it invisible.

if( rgStateTax.MasterTableView.IsItemInserted ) This checks if the element has been inserted into the grid.

foreach( GridItem item in rgStateTax.Items ) This goes through each element in the radgrid.

item.Visible = false; This means that every element is invisible.

Regarding the next part:

if( rgStateTax.EditItems.Count > 0 ) , .

foreach( GridDataItem item in rgStateTax.Items ) radgrid ( , ).

if( item != rgStateTax.EditItems[0] ) , ( , .

item.Visible = false; , .

, .

0

,

    if(!item.Edit){item.Visible = false;}
0

Source: https://habr.com/ru/post/1705961/


All Articles