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

Problem with ajax request

1 Answer 65 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Jean asked on 25 May 2010, 04:57 PM
Hi ! I spent all this afternoon on a problem without findind a solution :(

I added an ASP.NET AJAX Q3 2009 Radgrid :
<telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" AutoGenerateColumns="False" 
                    Skin="WebBlue" AllowSorting="True" AllowPaging="True" OnNeedDataSource="RadGrid1_NeedDataSource"  
                    EnableAJAX="True" OnItemCommand="RadGrid1_ItemCommand" OnItemEvent="RadGrid1_ItemEvent"
                        <SortingSettings SortedAscToolTip="Tri croissant" SortedDescToolTip="Tri d&#233;croissant" 
                            SortToolTip="Trier" /> 
                            <RowIndicatorColumn Visible="False"
                                <HeaderStyle Width="20px" /> 
                            <ExpandCollapseColumn Resizable="False" Visible="False"
                                <HeaderStyle Width="20px" /> 
                                <telerik:GridBoundColumn DataField="Cli" meta:resourcekey="CliColumnResource" UniqueName="Cli"
                                <telerik:GridBoundColumn DataField="ACId" meta:resourcekey="ACIdColumnResource" UniqueName="ACId"
                                <telerik:GridBoundColumn DataField="ArchiveId" meta:resourcekey="ArchiveIdColumnResource" UniqueName="ArchiveId"
                              <Selecting AllowRowSelect="True" /> 
                        <SelectedItemStyle BackColor="Blue" ForeColor="White" /> 

In code behind I added that :
RadGrid1.MasterTableView.ClientDataKeyNames = new string[] { "ArchiveId""ACId" }; 
            this.RadGrid1.ClientSettings.ClientEvents.OnRowSelected = "RowSelected"

in order to do something on row selected...

Here is the definition of RowSelected funtion :
<script type="text/javascript"
    function RowSelected(sender, eventArgs) { 
        var archiveId = eventArgs.getDataKeyValue("ArchiveId"); 
        var archiveClassId = eventArgs.getDataKeyValue("ACId"); 

And in code behind :
protected override void RaisePostBackEvent(IPostBackEventHandler sourceControl, string eventArgument) 
            base.RaisePostBackEvent(sourceControl, eventArgument); 
            if (eventArgument == null
            if (eventArgument.Trim() == ""
            string[] parts = eventArgument.Split(':'); 
            switch (parts[0]) 
                case "RadGrid1_RowSelected"
                    string[] subparts = parts[2].Split('ยค'); 
                    TbxArchiveId.Text = subparts[1]; 
                    TbxCAId.Text = subparts[0]; 

When I debug with IE, it tells me that "window[...]" is null.

How can it be ?? :(

Can you help me please ?

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 28 May 2010, 01:00 PM
Hello Jean,

To get the RadGrid on client side you need to use the $find() operator. Please check out the following online documentation article which explains how to get RadGrid client object:
Also to perform an ajax request from client side you need to get the RadAjaxManager and call its ajaxRequest() method. I believe that the following RadAjaxManager's HowTo section will be of help.

Sincerely yours,
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question