Datagrid - Template column
-
Hi, I want to add a template column in a datagrid during a runtime and also want to asign images to that template column at the runtime. can anyone tell me how can i do that? Thanks for your help in advance,
you can add Template column in datagrid dynamicaly according to ur recqurement. where you are binding you can write this dgExample.Columns.AddAt(position,templatecolmn) or u have option like you can use protected variable at code behind page and assign it to column like this suppose strHTML is protected variable at code behind then write in code behind page like strHTML="
" and use it in your aspx page like this <%=strHTML>
amit
-
you can add Template column in datagrid dynamicaly according to ur recqurement. where you are binding you can write this dgExample.Columns.AddAt(position,templatecolmn) or u have option like you can use protected variable at code behind page and assign it to column like this suppose strHTML is protected variable at code behind then write in code behind page like strHTML="
" and use it in your aspx page like this <%=strHTML>
amit
Thanks Amit. Actually I already found the solution. I need to to initialize the ItemType of my Template column using user defined class and it works for me but now i am having a problem to export my datagrid to excel. I am able to export the columns which i have added in a design but there are template columns i am adding programatically and somehow its not showing in excel. May be because it is not defined in xml??