I have a javascript function that I call that disable or enable a WebGrid clientside.
Here is the function.
function SetGridDisabledState(bDisable) { var grid = igtbl_getGridById("UltraWebGrid1"); if ((grid != null) && (grid != undefined)) { grid.Element.disabled = bDisable; } }
This function works perfectly in IE. When its called, passing true, the grid is immediately disabled. In Firefox however, it does nothing.
Can anyone help me on this?
I am using version 9.1of NetAdvantage for asp.net 3.5.
Hi,
Thank you for your sample code. I am quite new to JQuery, so where should I put this function? Do I have to write some code in $(document).ready(function() { }); ??
Basically, what I am trying to do is: when users click a button, I want to disable the Grid immediately.
I got the following code:
<
asp:Button ID="btnSave" runat="server" OnClientClick="btnSave_OnClientClick()" OnClick="btnSave_Click" Text="Save enrolment" Width="120px" style="margin-right:50px;" />
and I have a javascript function btnSave_OnClientClick().
So question is: Should I put your code in my javascript function or $(document).ready(function() { }); block??
Thanks a lot for your help.
Regards,
Xiaosu
Here is what I ended up doing. It worked for me, but is probably not the best way and feels like a hack.
function SetGridDisabledState(bDisable) { if ((myGrid != null) && (myGrid != undefined)) { if (isIE() == true) { myGrid.Element.disabled = bDisable; } else if (isFirefox() == true) { // have to set attribute in FF. if (bDisable == true) { $("#myGridId").attr("disabled", true); } else $("#myGridId").removeAttr("disabled"); } } }
The only way I figured out how to do it was to manually find the grids element by its ID using jQuery, and calling jQuery attr method to mark it disabled. Its a hack. isIE and isFirefox are just functions we have to determine the browser.
Basically, figure out a way to grab the grids html element (jQuery selector or GetElementByID) and set the disabled attribute of the element. I used Firebug to examine the DOM and figure out which element to select. There probably is a much easier way to do it but since nobody offered any suggestions, I had no other choice but to hack it.
Hope that helps.
I got the same problem. Did you find an answer to that?
Thanks