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

RadGrid Rebind

2 Answers 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Monique Smartt
Top achievements
Rank 1
Monique Smartt asked on 18 Nov 2008, 11:37 PM
I am trying to refresh a RadGridfrom a control outside of the grid itself. I am testing this with a button click, but want to implement it on a rad window close. I have seen a ton of examples which I have implemented exactly but I keep receiving a JavaScript error. The error alerts upon clicking the button "Object doesn't support this property or method"

On a side not, all of the examples I have seen use the EnableAJAX="True", but it is not part of the intellisense. Can anyone explain.

I appreciate any help. Thanks

                <telerik:RadGrid ID="gridAccounts" runat="server" EnableAJAX="True" OnItemCreated="gridAccounts_ItemCreated" OnNeedDataSource="gridAccounts_OnNeedDataSource" Skin="" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false"
                    <AlternatingItemStyle CssClass="AltRow" /> 
                    <SortingSettings SortedAscToolTip="Sort A - Z" SortedDescToolTip="Sort Z - A" /> 
                    <MasterTableView AutoGenerateColumns="False" CssClass="DataTable" DataKeyNames="ID"  PageSize="5" AllowPaging="true" AllowSorting="true" AllowNaturalSort="false"
                        <Columns> 
                            <telerik:GridBoundColumn DataField="ID" Visible="false" UniqueName="ID" /> 
                            <telerik:GridBoundColumn DataField="LastName" HeaderText="Last Name" SortAscImageUrl="../Images/Grid/SortDesc.gif" SortDescImageUrl="../Images/Grid/SortAsc.gif" SortExpression="LastName" UniqueName="LastName" ItemStyle-Width="15%" /> 
                            <telerik:GridBoundColumn DataField="FirstName" HeaderText="First Name" SortAscImageUrl="../Images/Grid/SortDesc.gif" SortDescImageUrl="../Images/Grid/SortAsc.gif" SortExpression="FirstName" UniqueName="FirstName" ItemStyle-Width="15%" /> 
                            <telerik:GridBoundColumn DataField="UserName" HeaderText="User Name" SortAscImageUrl="../Images/Grid/SortDesc.gif" SortDescImageUrl="../Images/Grid/SortAsc.gif" SortExpression="UserName" UniqueName="UserName" ItemStyle-Width="20%" /> 
                            <telerik:GridBoundColumn DataField="Office" HeaderText="Office" SortAscImageUrl="../Images/Grid/SortDesc.gif" SortDescImageUrl="../Images/Grid/SortAsc.gif" SortExpression="Office" UniqueName="Office" ItemStyle-Width="25%" /> 
                            <telerik:GridBoundColumn DataField="Access" HeaderText="Access" SortAscImageUrl="../Images/Grid/SortDesc.gif" SortDescImageUrl="../Images/Grid/SortAsc.gif" SortExpression="Access" UniqueName="Access" ItemStyle-Width="10%" /> 
                            <telerik:GridBoundColumn DataField="Status" HeaderText="Status" SortAscImageUrl="../Images/Grid/SortDesc.gif" SortDescImageUrl="../Images/Grid/SortAsc.gif" SortExpression="Status" UniqueName="Status" ItemStyle-Width="15%" /> 
                        </Columns> 
                        <SortExpressions> 
                            <telerik:GridSortExpression FieldName="LastName" SortOrder="Ascending" /> 
                        </SortExpressions> 
                        <NoRecordsTemplate>                
                            <div class="GridViewNoRecords">No Records Found</div> 
                        </NoRecordsTemplate> 
                    </MasterTableView> 
                    <PagerStyle Mode="NextPrevAndNumeric" ShowPagerText="false" CssClass="GridViewPager" NextPageImageUrl="~/Images/Grid/PagingNext.gif" FirstPageImageUrl="~/Images/Grid/PagingFirst.gif" LastPageImageUrl="~/Images/Grid/PagingLast.gif" PrevPageImageUrl="~/Images/Grid/PagingPrev.gif" /> 
                </telerik:RadGrid>         
            </asp:Panel>    
            <input type=button value="Refresh" onclick='window["<%= gridAccounts.ClientID %>"].AjaxRequest( "<%= gridAccounts.UniqueID%>", "Rebind")' /> 

        protected override void RaisePostBackEvent(IPostBackEventHandler source, String eventArgument) 
        { 
            base.RaisePostBackEvent(source, eventArgument); 
            switch (eventArgument) 
            { 
                case "Rebind"
                    gridAccounts.Rebind(); 
                    break
            } 
        } 

2 Answers, 1 is accepted

Sort by
0
Monique Smartt
Top achievements
Rank 1
answered on 20 Nov 2008, 10:06 AM
Any help on this? Please. Again just trying to rebind the radgrid when I close a radwindow with the close icon in the top bar.
0
Yavor
Telerik team
answered on 21 Nov 2008, 01:11 PM
Hello Monique,

The issue here is with the way the client object is referenced. To see more information on this, please refer to the following article.
Additionally, please keep in mind that the grid control no longer supports Ajax internally - you can use the AjaxManager control, or the AjaxPanel instead.
I hope this helps.

Kind regards,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Monique Smartt
Top achievements
Rank 1
Answers by
Monique Smartt
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or