Intersoft WebGrid Documentation
How-to: Remove (+) sign for Self Reference LoadOnDemand rows that contain no Child Row
See Also Send comments on this topic.

Glossary Item Box

WebGrid SelfReference LoadOnDemand can remove the (+) sign if the row contains no child row to be expanded.

In this topic, you will learn how to remove the (+) mark on self reference load on demand in WebGrid.

To Remove (+) sign in Self Reference LoadOnDemand rows in WebGrid

  1. Drag and drop a WebGrid to your form.
  2. Drag and drop ISDatasource and specify Self Reference LoadOnDemand in WebGrid
  3. In InitializeRow event at the server side, use e.Row.SelfRefChildNotExpandable = true; code to remove the + button.
  4. C# Copy Code
    private void WebGrid1_InitializeRow(object sender, ISNet.WebUI.WebGrid.RowEventArgs e)
    {
            OleDbCommand comm = new OleDbCommand("select * from employees where reportsto = " + e.Row.KeyValue.ToString(),oleDbConnection1);
            oleDbConnection1.Open();
            OleDbDataReader dtr = comm.ExecuteReader();
    
            if(!dtr.HasRows)
                    e.Row.SelfRefChildNotExpandable = true;
    
            oleDbConnection1.Close();                       
    }
    

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.