How to change a BoundField's control in asp.net -


can change boundfield's control?

<asp:boundfield datafield="week1" headertext="week1" sortexpression="begindate" /> 

you can't change control that's created when use boundfield - that's chosen automatically based on data type of field you're binding (a checkbox gets created boolean fields, label text-type fields).

you need use templatefield if want bind data different type of control:

<asp:templatefield headertext="week1">     <itemtemplate>         <asp:label id="weekonelbl" text= '<%# eval("week1") %>' runat="server"/>     </itemtemplate> </asp:templatefield> 

by default, boundfield use label control (like above). templatefield, change to, say, read-only textbox:

<asp:templatefield headertext="week1">     <itemtemplate>         <asp:textbox id="weekonelbl" text= '<%# eval("week1") %>' runat="server" readonly="true" />     </itemtemplate> </asp:templatefield> 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -