.Net 2.0 - Edit Bit datatype in a gridview

G

Guest

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?
 
G

Guest

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?

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top