We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

checkbox in datagrid stays greyed out..

Thread ID:

Created:

Platform:

Replies:

15159 Jun 12,2004 02:34 AM UTC WinForms 0
loading
Tags: FAQ
Magnus
Asked On June 12, 2004 02:34 AM UTC

Hi I have created a windows form that hold a datagrid, that datagrid gets it values from a stored procedure. My problem is that I have added a checkbox to the datagrid and applied some style to the datagrid. But the checkbox is always greyed out. Why is that, and what am I doing wrong? Here''s my code... Sub BindData(ByVal OrderID As String) Dim myConnection As SqlConnection Dim myCommand As SqlCommand Dim myDataAdapter As SqlDataAdapter Dim myDataSet As New DataSet Dim strConn As String strConn = ("myconnstr") myConnection = New SqlConnection(strConn) myConnection.Open() myCommand = New SqlCommand("p_PDFDetail", myConnection) myCommand.CommandType = CommandType.StoredProcedure myCommand.Parameters.Add("@CartID", SqlDbType.NVarChar, 50).Value = OrderID myDataAdapter = New SqlDataAdapter(myCommand) myDataAdapter.Fill(myDataSet, "tbl_Order") Dim myDataTable As New DataView(myDataSet.Tables("tbl_Order")) myDataSet.Tables("tbl_Order").Columns("InfileMap").ColumnMapping = MappingType.Hidden Dim ts1 As New DataGridTableStyle ts1.MappingName = "tbl_Order" ts1.AlternatingBackColor = Color.LightGray Dim TextCol1 As New DataGridTextBoxColumn Dim TextCol2 As New DataGridTextBoxColumn Dim TextCol3 As New DataGridTextBoxColumn Dim TextCol4 As New DataGridTextBoxColumn Dim TextCol5 As New DataGridTextBoxColumn TextCol1.MappingName = "CartID" ''from dataset table TextCol1.HeaderText = "OrderID" TextCol1.Width = 100 TextCol2.MappingName = "Quantity" ''from dataset table TextCol2.HeaderText = "Qty" TextCol2.Width = 50 TextCol2.Alignment = HorizontalAlignment.Center TextCol3.MappingName = "ArtNr" ''from dataset table TextCol3.HeaderText = "Article nr" TextCol3.Width = 75 TextCol4.MappingName = "Description" ''from dataset table TextCol4.HeaderText = "Product" TextCol4.Width = 250 TextCol5.MappingName = "Country" ''from dataset table TextCol5.HeaderText = "Language" TextCol5.Width = 100 ts1.GridColumnStyles.Add(TextCol1) ts1.GridColumnStyles.Add(TextCol2) ts1.GridColumnStyles.Add(TextCol3) ts1.GridColumnStyles.Add(TextCol4) ts1.GridColumnStyles.Add(TextCol5) MyDataGrid.DataSource = myDataSet ''MyDataGrid.AlternatingBackColor = Color.LightGray MyDataGrid.TableStyles.Add(ts1) MyDataGrid.ReadOnly = True ''STEP 4: Add the checkbox Dim boolCol As New DataGridBoolColumn With boolCol .HeaderText = "Make PDF" .MappingName = "ID" .Width = 75 .TrueValue = True .FalseValue = False .ReadOnly = False .Alignment = HorizontalAlignment.Center .AllowNull = False End With ts1.GridColumnStyles.AddRange(New DataGridColumnStyle() {boolCol}) MyDataGrid.TableStyles.Add(ts1) MyDataGrid.DataMember = "tbl_Order" End Sub Regards Magnus

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;