Example #1
0
        private void radComboDemo_ItemDataBound(object sender, ListItemDataBoundEventArgs e)
        {
            RadListDataItem item = e.NewItem;
            item.Text += " " + (item.DataBoundItem as DataRowView)["FirstName"];

            Telerik.Examples.WinControls.DataSources.NorthwindDataSet.EmployeesRow row = (item.DataBoundItem as DataRowView).Row as Telerik.Examples.WinControls.DataSources.NorthwindDataSet.EmployeesRow;
            item.Image = GetImageFromData(row.Photo);

            item.Font = new Font("Arial", 10, FontStyle.Bold);
        }
Example #2
0
        private void LoadDataForUnbound()
        {
            Random           random   = new Random((int)DateTime.Now.Ticks);
            GridViewTemplate template = this.radGridView1.MasterTemplate.Templates[0];

            for (int i = 0; i < nwindDataSet.Employees.Count; i++)
            {
                Telerik.Examples.WinControls.DataSources.NorthwindDataSet.EmployeesRow row = nwindDataSet.Employees[i];
                string name = row.FirstName + " " + row.LastName;

                this.radGridView1.MasterTemplate.Rows.Add(GetImageFromBytes(row.Photo), name, random.Next(45000),
                                                          row.HireDate, row.Title, (random.Next(100) > 50));

                int rowCount = random.Next(20);
                while (rowCount <= 0)
                {
                    rowCount = random.Next(20);
                }

                for (int j = 0; j < rowCount; j++)
                {
                    template.Rows.Add(name, random.Next(1000), random.Next(50), random.Next(100), random.Next(10000));
                }
            }
        }