This is a migrated thread and some comments may be shown as answers.

GridView ReadOnly / Alternating Color

3 Answers 174 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 16 Jan 2008, 08:34 AM
Hi,

This is just a suggestion: setting GridView.MasterGridViewTemplate.AllowAddNewRow to false when selecting the gridview as readonly.

I cannot really imagine a situation where you would allow a user to insert a record but not be able to update it.

I only recommend this because I could not find the aforementioned property in the properties tab. It would be nice if this property was listed there but that's just me being nitpicky.

Lastly, could please describe how I can go about having a set color for every other row? I would like to have alternating colors for the rows similar to that of an ASP.NET GridView.

Thanks for the help,

Michael

3 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 16 Jan 2008, 12:53 PM
Hello Michael,

Thank you for the suggestions.

We modeled RadGridView to act like the standard MS DataGridView. When the ReadOnly property is set to true the DataGridView still shows the "Add New Row".

We will consider exposing the AllowAddNewRow property in RadGridView for our upcoming release.

The best way to display alternating rows is to modify an existing theme. You can also do it through code by
using the RowFormatting. Refer to the following code snippet:

this.radGridView1.RowFormatting += new RowFormattingEventHandler(radGridView1_RowFormatting); 
void radGridView1_RowFormatting(object sender, RowFormattingEventArgs e) 
    if (e.RowElement.IsOdd) 
    { 
        if (!e.RowElement.IsCurrent) 
        { 
            e.RowElement.BackColor = Color.FromArgb(0xF0, 0xF0, 0xF0); 
        } 
        else 
        { 
            e.RowElement.BackColor = Color.FromArgb(202, 238, 254); 
        } 
    } 
 


Don't hesitate to write us if you need further assistance.

Greetings,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Michael
Top achievements
Rank 1
answered on 16 Jan 2008, 05:30 PM
Thank you for your help. The formating code was exactly what I was looking for.

Michael
0
Kiril
Telerik team
answered on 17 Jan 2008, 09:08 AM
Hi Michael,

I'm glad to hear the issue is now resolved. If you have any other questions, please do not hesitate to contact us.

All the best,
Kiril
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
Michael
Top achievements
Rank 1
Answers by
Jack
Telerik team
Michael
Top achievements
Rank 1
Kiril
Telerik team
Share this question
or