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

RadGrid not find first time in javascript in firefox

4 Answers 37 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kishor Dalwadi
Top achievements
Rank 2
Kishor Dalwadi asked on 18 Apr 2011, 02:28 PM
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.

4 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 21 Apr 2011, 12:03 PM
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.

0
Kishor Dalwadi
Top achievements
Rank 2
answered on 21 Apr 2011, 12:39 PM
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.
0
Mira
Telerik team
answered on 21 Apr 2011, 01:06 PM
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.

0
Kishor Dalwadi
Top achievements
Rank 2
answered on 21 Apr 2011, 01:19 PM
Thank you Very much.

It's working perfectly as my requirement.

Thanks a lot.
Tags
Grid
Asked by
Kishor Dalwadi
Top achievements
Rank 2
Answers by
Mira
Telerik team
Kishor Dalwadi
Top achievements
Rank 2
Share this question
or