0

I have a web part with SPGridView. I defined TemplateField for SPGridView.

 TemplateField tmp = new TemplateField();
 tmp.HeaderText = field.Title;
 tmp.ItemTemplate = new AddTemplateToGridView(ListItemType.Header, field.InternalName);
 grid.Columns.Add(tmp);

when load page, all data display , but when filter or sort a column , don't display item in template field.

1 Answer 1

1

My guess is that your code to add the column is not in a method that is called on post back.

I recommend reviewing the ASP.NET control lifecycle.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.