Winform Telerik RadListView populates data but text is not visible

4 posts, 0 answers
  1. Isai
    Isai avatar
    2 posts
    Member since:
    Sep 2018

    Posted 16 Sep 2018 Link to this post

    Hello, I have the following code at the bottom which should load data automatically into the RadListView at form load. However, the text is not visible in the RadListView. I can see the exact number of rows being returned from the SQL database into the RadListView. why is the text not visible?

     

    Thank you for your help in advance! :)

     

     

    private void MemberUC_Load(object sender, EventArgs e)
            {
                //fill main panel
                this.Dock = DockStyle.Fill;
               
                using (SqlConnection con = new SqlConnection(*connection string string goes here*))
                {
                    con.Open();
                    cmd = new SqlCommand("SELECT FirstName, MiddleName, LastName, MemberType FROM dbo.MemberInformation");
                    cmd.Connection = con;
                    dr = cmd.ExecuteReader();
                    while (dr.Read())
                    {
                        ListViewItem item = new ListViewItem();
                        item.SubItems.Add(dr["FirstName"].ToString());
                        item.SubItems.Add(dr["MiddleName"].ToString());
                        item.SubItems.Add(dr["LastName"].ToString());
                        item.SubItems.Add(dr["MemberType"].ToString());
                        memberDetailsLV.Items.Add(item);
                    }
                }
            }

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3955 posts

    Posted 18 Sep 2018 Link to this post

    Hello, Isai,  

    When in DetailsView, RadListView displays columns. The columns are stored in a collection that is accessible through the Columns property. Columns can be added to RadListView using one of the three overloads of the Add method. Each column must have a unique name because columns are distinguished by their Name property. You can set cell values to the items of RadListView using their indexers. The keys can be either the index of the column, the name of the column, or the column itself.

    You can refer to the following help article demonstrating how to add columns and specify the value for each cell: https://docs.telerik.com/devtools/winforms/listview/populating-with-data/unbound-mode
     
    I hope this information helps.

    Regards,
    Dess
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Isai
    Isai avatar
    2 posts
    Member since:
    Sep 2018

    Posted 22 Sep 2018 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hello Dess,

     

    Thank you so much for your help! The link you sent shined a light on where I was having the problem.

    Turns out that I was also missing the 'using Telerik.WinControls.UI' namespace which would not let me use ListViewDataItem item = new ListViewDataItem();

  4. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3955 posts

    Posted 24 Sep 2018 Link to this post

    Hello, Isai,  
     
    I am glad that the suggested documentation was useful for achieving your requirement.

    You can try the Telerik UI for WinForms suite, which you can learn more about via the product page and comes with a 30-day free trial giving you some time to explore the toolkit and consider using it for your current or upcoming WinForms development.

    Regards,
    Dess
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top