RadGrid not find first time in javascript in firefox

5 posts, 0 answers
  1. Kishor Dalwadi
    Kishor Dalwadi avatar
    40 posts
    Member since:
    Nov 2009

    Posted 18 Apr 2011 Link to this post

    Dear Sir,

    I am using radgrid control and get it's column value in javascirpt.

    It's working fine with IE and Chrome but it's not working in firefox firsttime.

    It's giving error "grid not found" in javascirpt.

    After loading firsttime in firefox it will be working fine also.

    So please give me proper solution for that.

    I giving my javascriot.

    ------------------- CODE ------------------
    <telerik:RadScriptBlock ID="dsf" runat="server">
            <script language="javascript" type="text/javascript">
                function CheckItems() {
                    var Message = "<b>" + document.getElementById("<%= txtLabelName.ClientID %>").value + " </b><br />";
                    var grid = $find("<%=grdMandatoryInstructions.ClientID %>");
                    var MasterTable = grid.get_masterTableView();
                    Message += "<ul>"
                    for (var i = 0; i < MasterTable.get_dataItems().length; i++) {
                        record = MasterTable.get_dataItems()[i];
                        if (record.findElement("chkItem").checked) {
                            Message += "<li>" + record.findElement("lblDispalyName").innerHTML + "</li>";
                        }
                    }
                    document.getElementById("<%= lblLabelMessage.ClientID %>").innerHTML = Message + "</ul>";
                }           
            </script>
        </telerik:RadScriptBlock>
    ------------------------------------------------

    Thanking you.
  2. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 21 Apr 2011 Link to this post

    Hello Kishor,

    I tried to replicate the issue which you described, but to no avail.
    Attached to this message, you will find the code which I used for testing.

    Please, take a look at it and let me know if there are any differences at your end, which I may be leaving out.

    Greetings,
    Mira
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kishor Dalwadi
    Kishor Dalwadi avatar
    40 posts
    Member since:
    Nov 2009

    Posted 21 Apr 2011 Link to this post

    Thanks for replying.


    I try your solution but still i am getting same problem.


    Actually i want this facility when page loaded. so i write this below code at code behind when page load.


    -----------------------------------------------------------------------
      protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RadGrid1.Rebind();
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "test", "<script type='text/javascript'>CheckItems();</script>");
            }
        }
    --------------------------------------------------------------

    Thanking you.
  5. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 21 Apr 2011 Link to this post

    Hello Kishor,

    I suggest that you use the following javascript code in order to implement the desired functionality:
    function pageLoad() {
        var Message = "<b>" + document.getElementById("<%= txtLabelName.ClientID %>").value + " </b><br />";
        var grid = $find("<%=grdMandatoryInstructions.ClientID %>");
        var MasterTable = grid.get_masterTableView();
        Message += "<ul>"
        for (var i = 0; i < MasterTable.get_dataItems().length; i++) {
            record = MasterTable.get_dataItems()[i];
            if (record.findElement("chkItem").checked) {
                Message += "<li>" + record.findElement("lblDispalyName").innerHTML + "</li>";
            }
        }
        document.getElementById("<%= lblLabelMessage.ClientID %>").innerHTML = Message + "</ul>";
    }
    Please note that you do not need to register it server-side.

    I hope it helps.

    Kind regards,
    Mira
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  6. Kishor Dalwadi
    Kishor Dalwadi avatar
    40 posts
    Member since:
    Nov 2009

    Posted 21 Apr 2011 Link to this post

    Thank you Very much.

    It's working perfectly as my requirement.

    Thanks a lot.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017