S
sloan
I am programmatically adding
BoundField's and
TemplateField's
to a GridView.
I have it working fine.
BoundField bf = new BoundField();
bf.DataField = "EmpID";
bf.HeaderText = "The Employee ID";
bf.SortExpression = "EmpID";
mygridview.Columns.Add(bf);
I know the TemplateFields are not as simply created, but I do have them
working.
TemplateField tf = new TemplateField();
tf.ItemTemplate = new // My Custom Implementation
tf.HeaderTemplate = new //My Custom Implementation
mygridview.Columns.Add(tf);
The issue arises when I do postbacks..namely the sorting or paging.
When I page or sort the gridview.. the PostBack occurs.
All of the bound field's I've added (programatically) are still there.
All the TemplateField's I add programatically disappear.
I've found a few "I have this issue" posts thru googling. But no answers.
Anybody have any ideas?
I've tried to find some property to enable viewstate for the TemplateField,
but its not natively there.
...
BoundField's and
TemplateField's
to a GridView.
I have it working fine.
BoundField bf = new BoundField();
bf.DataField = "EmpID";
bf.HeaderText = "The Employee ID";
bf.SortExpression = "EmpID";
mygridview.Columns.Add(bf);
I know the TemplateFields are not as simply created, but I do have them
working.
TemplateField tf = new TemplateField();
tf.ItemTemplate = new // My Custom Implementation
tf.HeaderTemplate = new //My Custom Implementation
mygridview.Columns.Add(tf);
The issue arises when I do postbacks..namely the sorting or paging.
When I page or sort the gridview.. the PostBack occurs.
All of the bound field's I've added (programatically) are still there.
All the TemplateField's I add programatically disappear.
I've found a few "I have this issue" posts thru googling. But no answers.
Anybody have any ideas?
I've tried to find some property to enable viewstate for the TemplateField,
but its not natively there.
...