How to create WebGridColumn at runtime

1 reply. Last post: June 11, 2010 12:36 PM by Handy Surya
Tags :
  • New Discussion
  • New Question
  • New Product Feedback

Hi,

I was just trying to create WebGridColumns (Button column) at runtime. I wrote the following code on WebGrid1_PrepareDataBinding event :


WebGridColumn column = new WebGridColumn("NewCol", "NewCol", Unit.Pixel(80));
column.Bound = true;
column.Name = txtFieldName.Text;
column.ColumnType = ColumnType.Button;
column.ButtonText = "Hello Button";

BudgetGrid.RootTable.Columns.Add(column);

But the second time when i click the button, a new column does gets created sucessfully, but the previous Button column does not shows the caption of all the buttons. It only shows all buttons but with empty text in it.


Any comments would be really apprecaited.
Thanks in advance.

Anup Vasudeva
All times are GMT -5. The time now is 10:38 PM.
Previous Next