Unless I'm mistaken, I assume that you wish to change the caption of a column within a client-side script, right? If so, the ASPxGridView doesn't support this functionality, sorry. Using the callback technology is not a good option either, since in this situation the control's ViewState isn't updated, and so the column's caption will be restored once the GridView's layout is modified (for instance, if you group or sort data, change the column's position, etc.). So, it looks as if the only way to accomplish this task is to initiate a postback and change the caption on the server side. Attached is a small sample project that demonstrates this approach. Please try it and let us know your results.
Perhaps I could have been clearer. Assume I have a generically named column named "CustomColumn1". Also assume that I have a configuration setting "CustomColumn1Name" that would contain a configurable name for that custom column. Prior to displaying the grid, I need to be able to change that grid-colunm's displayed header caption to the text contained within my "CustomColumn1Name". It should all be able to occur prior to rendering the page, and it feels like it should be simple (yet I am missing it somehow).
Thank you for the response.
If I correctly understand your objective, I suggest that you handle the Page's Load event for this purpose. Here you can use the ASPxGridView.Columns collection to access the required column, and finally use its Caption property to adjust its caption as required. For more information, please refer to the "ASPxGridView.Columns Property" topic in the ASPxGridView documentation.
If you're experiencing any difficulty with implementing this functionality, we'll be happy to help you address it. Just describe the problem you ran into in as much detail as possible, so that we can find the most appropriate solution for you.
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.