vendredi 16 avril 2021

My checkbox doesn't appear on the UI , when dynamically created in grid

Im totally new to vb , so please help me with the problem.

I have created a checkbox dynamically , and added in the gridview like below , but still , I'm not able to see that column as Checkbox column . While debugging i can see that a new column is been created in the line 'resp.Columns.Add(column) ', but in UI it shows as a simple plain text field. Please help me with that.

    Dim ToAppCol As New CheckBox()    
    ToAppCol.Name = "toapprove"    
    ToAppCol.Checked = False    
    ToAppCol.Enabled = True    
    ToAppCol.Text = "To Approve"    
    ToAppCol.Width = "100"    

    Dim newField As GridFieldInfo    
    newField.Name = ToAppCol.Name    
    newField.Label = ToAppCol.Text    
    newField.Width = ToAppCol.Width    
    newField.Control = "checkbox"    
    newField.Type = "CHKBOOLEAN"    
    newField.Visible = True    
    'newField.Order = 1 ' though order gave as 1 , still didnot work.    
    grdData.Fields.Add(newField)   

    For Each ss As GridFieldInfo In grdData.Fields    
        If (ss.Visible) Then    
            Dim column As New Column    
            column.id = ss.Name    
            column.title = ss.Label    
            column.width = ss.Width    
            column.control = ss.Control    
            column.dataType = ss.Type    
            resp.Columns.Add(column)    
        End If    
    Next    

Regards




Aucun commentaire:

Enregistrer un commentaire