How to use a Checkbox in a report

2 posts, 0 answers
  1. John
    John avatar
    9 posts
    Member since:
    Sep 2014

    Posted 28 Jan 2015 Link to this post

    For a textbox I use

    Private Sub nvcQuestion_ItemDataBound(sender As Object, e As EventArgs) Handles nvcQuestion.ItemDataBound
    Dim txt As Telerik.Reporting.Processing.TextBox = DirectCast(sender, Telerik.Reporting.Processing.TextBox)
    Dim dataObject As Telerik.Reporting.Processing.IDataObject = DirectCast(txt.DataObject, Telerik.Reporting.Processing.IDataObject)
    If DirectCast(dataObject("nvcqQuestion"), String) <> "" Then
       txt.Value = dataObject("nvcqQuestion").ToString()
    End If
    End Sub

    For a Checkbox I tried something like the following

    Private Sub bitTitle_ItemDataBound(sender As Object, e As EventArgs) Handles bitTitle.ItemDataBound
    Dim txt As Telerik.Reporting.Processing.CheckBox = DirectCast(sender, Telerik.Reporting.Processing.CheckBox)
    Dim dataObject As Telerik.Reporting.Processing.IDataObject = DirectCast(txt.DataObject, Telerik.Reporting.Processing.IDataObject)
    If DirectCast(dataObject("bitTitle"), CheckBox) = True Or False Then
       txt.Checked = dataObject("bitTitle") ????????
    End If
    End Sub

    Can anyone point out the problem and what the correct syntax is?
    Thanks,
    John
  2. Hinata
    Hinata avatar
    146 posts
    Member since:
    Dec 2013

    Posted 30 Jan 2015 in reply to John Link to this post

    Hi John,

    The correct way is to get rid of those events and use the report designer to create the checkbox.
    You can find more information on these forums why to avoid events and the rest is in the help:
    Report Designers
    Checkbox
Back to Top