Click here to Skip to main content
15,905,229 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Following is the javascript code where I am adding few items in existing rad context menu i.e. RadMenu1. There are few items already in it and I am adding few more items dynamically in javascript
JavaScript
function ContextMenuOpen(sender, args) 
{
    var menu = $find("m_c_RadMenu1");
    if (IsMobileBrowser() == false) 
    {
        var evt = args.get_domEvent();
    }
    menu.trackChanges();
    var items = menu._getAllItems()
    menu.get_items().clear();

    //menu.commitChanges();
    AddItem("Visit & View Details", "a");

    if (selectedRow.findElement("lblTask") != null) {
        var tasklist = selectedRow.findElement("lblTask").defaultValue;
        var taskArray = tasklist.split(',');

        for (i = 0; i < taskArray.length; i++) {
            if (typeof (taskArray[i].split('~')[1]) == 'undefined') break;
            AddItem("Perform " + taskArray[i].split('~')[1], taskArray[i].split('~')[0]);
        }
        //rb.AddItem(selectedRow.findElement("lblTask").innerText,4)
    }
    AddItem("Log an Incident", "b");
    if (rb.isLocationSelected == false) {

    AddItem("Log a Discrepancy", "c");
}


function AddItem(text, value) {
    var menu = rb.GetMenu();
    var item = rb.GetContextMenuItem(text);
    if (item != null) return false;
    var menuItem = new Telerik.Web.UI.RadMenuItem();
    menuItem.set_text(text);
    menuItem.set_value(value)
    menu.trackChanges();
    menu.get_items().add(menuItem);
    menu.commitChanges();
    return true;
}


Everything goes well , but the newly added context menu shows transparent background on rightside , I found it is filling the background only at the area where text is present , on empty area at rightside it is transparent (see attached image )

see the transparent background, right side of the items

image

do anybody know how to remove this transparent background?
Posted
Updated 18-Dec-11 22:08pm
v2

1 solution

adding css class
CSS
$("p").addClass("myClass yourClass");

removing css class
CSS
$("p").removeClass("myClass noClass");

$("p").css("background-color","white");

use like this when u use jquery

If u want to use javascript ,then go through like this

JavaScript
document.getElementById("your_id").style.background-color="#ffffff";
 
Share this answer
 
v2
Comments
Wendelius 19-Dec-11 12:38pm    
Pre tags added to enhance code readablity
vino2012 23-Dec-11 9:47am    
Thanks and now only I know this.I will keep up for my further codes.........

Because of your comment i got.........

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900