Basically I’m using the ItemSource property of the datagrid to bind a generic list to my datagrid. However I’d really like to change the headings, I tried the following but I get a runtime exception:
dgtest.Columns[1].Header = "edited";
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.
You can change it on the
ItemDataBoundevent:If the grid is already bound you should be able to do:
You are probably getting an error because you are trying to change the text before it is bound.