I have a table with a field with a bit datatype.
I use a gridview to edit that a row in that table. I use SQLDataSource and
enable editbutton property to get a link to edit the row.
That all works fine but after I click the edit link, the bit field turns
into a text field (displaying true/false string), rather than a checkbox (or
radiobutton).
Is this by design? I just want a checkdown to edit that true-false bit field?
Alexey Smirnov - 28 Jun 2007 08:57 GMT
> I have a table with a field with a bit datatype.
>
[quoted text clipped - 6 lines]
>
> Is this by design? I just want a checkdown to edit that true-false bit field?
for me it works well
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="server=..."
SelectCommand="SELECT Id, ... FROM ..."
updatecommand="UPDATE ... SET ... WHERE Id = @Id"
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server"
DataKeyNames="Id"
autogenerateeditbutton="true"
DataSourceID="SqlDataSource1"></asp:GridView>
I have a bit field and I see a checkbox in the edit mode.
I'm not sure if it makes sense to cast, try
SELECT ... CONVERT(bit,[fieldname]) as [fieldname]