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
- Drag and drop a WebGrid to your form.
- Drag and drop ISDatasource and specify Self Reference LoadOnDemand in WebGrid.
- In InitializeRow event at the server side, use e.Row.SelfRefChildNotExpandable = true; code to remove the + button.
-
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(); }