I want to set datatable header column fields to a Label controls Text property of a Gridview HeaderTemplate
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m not sure I understand your question, but if you want to bind from a datasource to Labels within a TemplateField’s HeaderTemplate and ItemTemplate, you can do this:
Where
header_database_fieldandcontent_database_fieldare the fields from your database that you wish to bind.If you want to assign a DataTable’s column name(s) to one of the TemplateField’s Labels, you could do something like this programmatically during the RowDataBound event, though I’m not sure why you’d want to:
Reaplce
datatablewith your DataTable, and modify the indexes to reference your Cell/Label(s)/ColumnNames.