1
Vote

Enable/Disable LargeItem trough javascript

description

Hi,
I am using OffceWebUi Ribbon in my source code.And in my code there is requirement of disableing an OfficeWebUI:LargeItem throught javascript on Page load.But I am not able to do it.Can any one help.Here is my source code.
 
<Content>
                                                    <OfficeWebUI:LargeItem ID="btnGR" runat="server" ImageUrl="~/Images/add_32.png" Text="Add / <br /> Duplicate" 
                                                        Tooltip="Add New Timespent with selected Row" OnClick="imgbtnadd_Click" />
                                                    <OfficeWebUI:LargeItem ID="imgbtndelete"  runat="server"  ImageUrl="~/Images/delete_32.png"    
                                                        Text="Delete" Tooltip="Delete selected Timespents"  OnClick="imgbtndelete_Click" />
</Content>
 
i need to disable the "imgbtndelete" trough java script on page load.

comments

Andy_G wrote Oct 29, 2011 at 8:40 AM

Hi,
I was looking at doing something very similar, the javascript function below seems to do the trick for me. Just pass in the ID of the button you want to disable. There is alos a function to re-enable it too.

function enablebtn(id) {
var btn = $('div [ItemID="' + id + '"]')
if (btn.hasClass('Disabled')) {
    btn.removeClass('Disabled')
    btn.attr("onclick", btn.attr("oldclick"));
}
}
function disablebtn(id) {
var btn = $('div [ItemID="' + id + '"]')
if (!btn.hasClass('Disabled')) {
    btn.addClass("Disabled");
    btn.attr("oldclick", btn.attr("onclick"));
    btn.attr("onclick", "");
}
}

wrote Feb 14, 2013 at 8:19 PM