Private Sub RadGridView1_CellFormatting(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.CellFormattingEventArgs) Handles RadGridView1.CellFormatting Dim equationFont As New Font("Cambria", 9, FontStyle.Bold Or FontStyle.Italic) If e.Row.DataBoundItem.Row("EQUATION") = "Y" Then e.CellElement.Font = equationFont If gbUseColorCoding Then ' global boolean variable for users to disable colors e.CellElement.DrawFill = True e.CellElement.NumberOfColors = 1 e.CellElement.BackColor = Color.PaleGoldenrod Else e.CellElement.ResetValue(LightVisualElement.DrawFillProperty) e.CellElement.ResetValue(LightVisualElement.NumberOfColorsProperty) e.CellElement.ResetValue(LightVisualElement.BackColorProperty) End If Else e.CellElement.ResetValue(LightVisualElement.FontProperty) e.CellElement.ResetValue(LightVisualElement.DrawFillProperty) e.CellElement.ResetValue(LightVisualElement.NumberOfColorsProperty) e.CellElement.ResetValue(LightVisualElement.BackColorProperty) End IfEnd SubHi,
I have seen variations of this question asked on several different posts, but either the fix has either been irrelevant to my particular situation or the question has gone unanswered. I have created a simplified example that you can run on your own computer, so as to easily demonstrate my problem.
I have a simple class "dog" which contains a property "Breed" of enum type "DogBreeds". I wish to display this value in a GridView combo box, but using more user-friendly text than the enum values.
This is my data class:
Public Class Dog Private dmName As String Private dmColour As String Private dmBreed As DogBreeds Public Sub New(ByVal _name As String, ByVal _colour As String, ByVal _breed As DogBreeds) MyBase.New() dmName = _name dmColour = _colour dmBreed = _breed End Sub Public Property Name() As String Get Return dmName End Get Set(ByVal value As String) dmName = value End Set End Property Public Property Colour() As String Get Return dmColour End Get Set(ByVal value As String) dmColour = value End Set End Property Public Property Breed() As DogBreeds Get Return dmBreed End Get Set(ByVal value As DogBreeds) dmBreed = value End Set End PropertyEnd ClassPublic Enum DogBreeds Staff Husky GShepEnd Enum'Add some example data dogs = New List(Of Dog)dogs.Add(New Dog("Sacha", "Brown", DogBreeds.Staff))dogs.Add(New Dog("Nimbus", "Black/Brown", DogBreeds.GShep))dogs.Add(New Dog("Chinook", "White", DogBreeds.Husky))'Set the grid data source:dgv.DataSource = dogs'Create the data source for the combo column, comprosed of a column of the enum and a column of the' "friendly" string represetion for that enum valueDim dtBreeds As New DataTabledtBreeds.Columns.Add("BreedEnum", GetType(DogBreeds))dtBreeds.Columns.Add("BreedName", GetType(String))dtBreeds.Rows.Add(DogBreeds.GShep, "German Sheppard")dtBreeds.Rows.Add(DogBreeds.Husky, "Icelandic Husky")dtBreeds.Rows.Add(DogBreeds.Staff, "Staffordshire Bull Terrier")'Set the column display and value members and the data source for the comboWith DirectCast(dgv.Columns("Breed"), GridViewComboBoxColumn) .DisplayMember = "BreedName" .ValueMember = "BreedEnum" .DataSource = dtBreedsEnd WithRun the form. All the combos are blank, but when you click on a combo cell, the correct value is displayed, but disappears again when focus is lost from the cell, so it looks like a display bug. I have successfully used this method on a DataGrid, so not sure why it does not work here.
Any help much appreciated
Shane
Hi
I want to add record on fly by radgrid.
I have some textbox and two buttons (Insert and Submit) to add information in radgrid.
My senario is:
When user enter her/his info into textbox and click on the insert button, value of textbox must be inserted into radgrid at client side without save them into database. In the final user click on the submit button, then all rows in radgrid save in database.
I see this and this demo online, but in both of them using webservice and bind grid from database.
How I can do my senario?
Thank's
if (row.Cells["Status"].Value.Equals("complete")) row.VisualElement.ForeColor = Color.Gray;Telerik strives to constantly improve its support services but it is essential to have full information to supply precise replies. If we do not have enough details we will not be able to properly address your inquiry and we will ask for further info. The extra loop is sure to slow down the time it takes to resolve your problem, and subsequently the further development of your project.
It is vital that you follow these guidelines in order to receive an accurate response:
ENJOY!!!
Best Wishes,
The Telerik team