.net - Extending Gridview Templatefield making it reusable -
i made work, not in appropirate way.
i'm working .net 4.0 , these needs:
i work big bunch of gridviews shows same kind of controls , works in same way.
what i've tried creating custom templatefield that, through desing-time properties, indicates templatefield's type , it's databind field name ddbb.
for instance, have lot of gridviews contains templatefields identical controls, ddbb column name different. have this:
<asp:gridview id="gridview" runat="server"> <columns> <customprefix:customtemplatefield type="datefield" bindfieldname="ddbb.colum_name" editable="true"> </columns> </asp:gridview>
and this, coded in code-behind adding itemtemplate (with label showing date ddbb) , edititemtemplate (because of editable property setted true) textbox , ajax_calendarextender.
this way, reuse implementation trhough mutiple gridviews, since provide unique differences through properties.
one of concrete problems had, in templatefield constructor cannot instanciates itemtemplate , edititemtemplate since desing-time properties not setted unitl later.
i don't know appropirate way (if possible). checked server controls, templated controls...
some guidance welcome
i hope understandable.
Comments
Post a Comment