Link to home
Start Free TrialLog in
Avatar of brgdotnet
brgdotnetFlag for United States of America

asked on

Checkbox in a dynamic GridVIew is not clickable?

I have created a GridView control which I populate dynamically in C#. Everything works great, except that the check boxes in my GridView control are not clickable. They appear to be greyed out. Do any experts know why this is happening (meaning Check box not clickable)? Below is my code with my data table also scripted out.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Crackle.aspx.cs" Inherits="WebApplication1.Crackle" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
 
    <form id="form1" runat="server">
          <asp:GridView ID="GridView1" runat="server"></asp:GridView>
    <div>
   
    </div>
          <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CustomersConnectionString2 %>" SelectCommand="SELECT [Id], [Name], [TrueOrFalse] FROM [SampleData]"></asp:SqlDataSource>
    </form>
</body>
</html>

    public partial class Crackle : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 
     
            GridView1.DataSource = SqlDataSource1;
            GridView1.DataBind();
        }
    }


USE [Customers]
GO
/****** Object:  Table [dbo].[SampleData]    Script Date: 1/19/2017 11:42:45 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SampleData](
      [Id] [int] NULL,
      [Name] [nvarchar](50) NULL,
      [TrueOrFalse] [bit] NULL
) ON [PRIMARY]

GO
INSERT [dbo].[SampleData] ([Id], [Name], [TrueOrFalse]) VALUES (1, N'Jed', 0)
GO
INSERT [dbo].[SampleData] ([Id], [Name], [TrueOrFalse]) VALUES (3, N'Marciasi', 0)
GO
SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of brgdotnet

ASKER

So how di I make them not read only?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Actually I ended up doing it in the C# in the Row Data Bound event handler.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial