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

Style on row - inline edit

1 Answer 220 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 09 Nov 2011, 10:34 PM
I have a RadGrid with all rows set to be editable (inline) in PreRender. I'm setting a background color (BackColor) on every other GridEditableItem in this step, because there is no alternate style for editable rows.

I've got a heavy border at the bottom of each row - as well as a background image (according to FireBug it's coming from an axd resource).

The "Selected" row style also is hidden because of this default background image.

I've spent several hours trying to get rid of the border (1px from the inline style and 1px from the background image), and have had no luck.  

I can disable the border in Firebug and/or IE's developer tools, on the fly, and eliminate the border, allow the Selected Row style to function, but I can't seem to do it in my app.

Any assistance for what should be a very simple task would be greatly appreciated!

In my default css:

div.RadGrid_Default .rgEditRow
{
    background-image:none !important;
    border:none;
}


PreRender in code-behind:

protected void Page_PreRender(object sender, EventArgs e)
       {
           bool alternate = false;
            
           foreach (GridItem item in grid.MasterTableView.Items)
           {
               if (item is GridEditableItem)
               {
                   GridEditableItem editableItem = item as GridDataItem;
                   editableItem.Edit = true;
                   if (alternate)
                   {
                       item.BackColor = System.Drawing.ColorTranslator.FromHtml("#efefef");
                   }
                   alternate = !alternate;
               }
           }
       }

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 10 Nov 2011, 06:52 AM
Hello Daniel,

please try with below code snippet

<style type="text/css">
        .editstyle
        {
            background-color: Red !important;
        }
    </style>

void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
   {
       if (e.Item is GridDataItem)
       {
           GridDataItem item = e.Item as GridDataItem;
           item.CssClass = "";
       }
 
       if (e.Item.IsInEditMode && e.Item is GridEditableItem)
       {
           GridEditableItem item = e.Item as GridEditableItem;
           item.CssClass = "editstyle";
       }
 
   }


Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or