Is it still not possible to use unbound columns?? Is the only way to accomplish this by creating a dataTable and binding to that??
Hi Scott,
This is on our road map and should be available in 11.1. An empty column in a data table could serve as a placeholder for an unbound column.
regards,David Young
I found a few ways around this.
If you know the object type you're going to be using you can bind the WDG to an empty list of said object. Tack on an ID field and you can use some of the AutoCrud things. As long as you don't try to save the list to session state or something crazy like that.
An example to follow:
public class exampleClass
{
public string foo {get; set;}
public string bar {get; set;}
public int ID {get; private set}
}
In your code behind:
protected void Page_Load(object sender, EventArgs e)
List<exampleClass> test = new List<exampleClass>();
SomeWebDataGrid.DataSource = test;
SomeWebDataGrid.DataBind();
You can add things in client side java script like this:
function addToGrid()
var grid = $find("<% SomeWebDataGrid.ClientID %>";
var rows = grid.get_rows();
var ID = Math.floor(Math.Random() *100001); //Can be whatever you want as long as its unique
var foo = "test1";
var bar = "test2";
var newRow = [ID, foo,bar]; //must be in order of columns
rows.add(newRow);
Hope this helps.