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

Ajax with Grid Update Not Working

7 Answers 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rita15
Top achievements
Rank 1
Rita15 asked on 12 Mar 2010, 07:37 PM
Hi,

   I am using RadGrid to display items. I use webusercontrol to edit Grid data. Everything was working fine.
After I added Ajax, the Grid Works fine, but the Update/delete is not working. I also use <asp:LinkButton for showing the edit form.

Can someone please help me?

<MasterTableView DataKeyNames="IDR_ID" GridLines="None" Width="100%" CommandItemDisplay ="Top" InsertItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage">   
              <CommandItemTemplate> 
                    <div style="padding: 5px 5px;"
                        &nbsp;&nbsp;&nbsp;&nbsp; 
                        <asp:LinkButton ID="btnEditSelected" runat="server" CommandName="EditSelected" Visible='<%# RadGrid1.EditIndexes.Count == 0 %>'><b>Edit selected</b></asp:LinkButton>&nbsp;&nbsp;&nbsp;&nbsp; 
                        <asp:LinkButton ID="btnCancel" runat="server" CommandName="CancelAll" Visible='<%# RadGrid1.EditIndexes.Count > 0 || RadGrid1.MasterTableView.IsItemInserted %>'><b>Cancel editing</b></asp:LinkButton>&nbsp;&nbsp; 
                        <asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert" Visible='<%# !RadGrid1.MasterTableView.IsItemInserted %>'><b>Add new</b></asp:LinkButton>&nbsp;&nbsp;&nbsp;&nbsp; 
                        <asp:LinkButton ID="LinkButton1" OnClientClick="javascript:return confirm('Delete selected IDR?')" runat="server" CommandName="DeleteSelected"><b>Delete selected IDR</b></asp:LinkButton>&nbsp;&nbsp; 
                        <asp:LinkButton ID="LinkButton4" runat="server" CommandName="RebindGrid"><b>Refresh IDR list</b></asp:LinkButton> 
                    </div> 
                </CommandItemTemplate>  


Thanks,
Rita



7 Answers, 1 is accepted

Sort by
0
robertw102
Top achievements
Rank 1
answered on 12 Mar 2010, 09:37 PM
Is the user control you use to update/delete also ajaxified? That could be the issue.
0
Rita15
Top achievements
Rank 1
answered on 12 Mar 2010, 11:08 PM
Yes, the user Control I use to update/delete is also ajaxified. Does that mean I can not ajaxify user control ??
If I can ajaxify the user control, can you please help me how to do that?

The current ajax code  inside the web user control is:
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server"
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="FName"
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="FName" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
    </AjaxSettings> 
</telerik:RadAjaxManagerProxy> 
<script language="javascript" type="text/javascript"
 

Thanks,
Rita
0
Tsvetoslav
Telerik team
answered on 15 Mar 2010, 10:44 AM
Hi Rita15,

If by user control, you mean that you are using it for the edit form of the grid, then indeed you need to remove the ajaxification of the user control as it is not needed. It is sufficient to ajaxify the whole grid in order to get all grid's operations to perform seamlessly without any browser flickering.

I hope this helps.

Regards,
Tsvetoslav
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.
0
Rita15
Top achievements
Rank 1
answered on 16 Mar 2010, 07:11 PM
Hi,

Thanks for the response.

here is what I am trying to do.
---------------------------------------------------------------------------------------------------------------
In the web page, there are 3 set of controls.
1) RadGrid 
2) A group of asp:LinkButton buttons OUTSIDE OF RADGRID( These are like ADD,UPDATE,DELETE buttons)
3) Other RadControls OUTSIDE OFRADGRID (Which shows Grid row related data )

When the selectedINdex of RadGrid Changes , I need to show the Grid row related data in No( 3)  Other RadControls OUTSIDE OF RADGRID

When  asp:LinkButton edit/Add button is clicked I want to show the web user control edit form.

I want to ajaxify each set of controls when any one(1) RadGrid ,2) A group of asp:LinkButton buttons,3) Other RadControls ) gets changed. 
-------------------------------------------------------------------------------------------------------------------------
Also is there a way to axafify RadGrid outside of RadGrid??? For example, when the edit/add link button is clicked, The RadGrid needs to be ajaxified.

Thanks!



0
Tsvetoslav
Telerik team
answered on 18 Mar 2010, 11:47 AM
Hi Rita,

Concerning the ajaxification issue, you can achieve in a couple of ways. Either by wrapping all the controls in a single RadAjaxPanel or through the RadAjaxManager adding the corresponding ajax settings. For example, if you need the grid to enter edit mode upon clicking the edit button and this being done through an ajax request, then (supposing your edit button has and ID of "btnEdit") your ajax setting for these two controls should be as follows:

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="btnEdit">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

and the code for putting the selected item in edit mode should be:

protected void btnEdit_Click(object sender, EventArgs e)
{
    RadGrid1.SelectedItems[0].Edit = true;
    RadGrid1.Rebind();
}


Regards,
Tsvetoslav
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.
0
Rita15
Top achievements
Rank 1
answered on 18 Mar 2010, 05:11 PM
Hi,

Thanks for the reply!

I am using Master Pages and the script Manager is in the Master page. So could you please give an example how to do that?

Thanks!

0
Tsvetoslav
Telerik team
answered on 23 Mar 2010, 02:04 PM
Hello Rita,

Just put the RadAjaxManager control on the master page and on the content pages add RadAjaxManagerProxy controls configuring their settings exactly as you should have done for the RadAjaxManager control and as shown in my previous post.
More informaion you can find the following help topics:
http://www.telerik.com/help/aspnet-ajax/ajax-manager-proxy.html
http://www.telerik.com/help/aspnet-ajax/ajxajaxmanager.html


All the best,
Tsvetoslav
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.
Tags
Grid
Asked by
Rita15
Top achievements
Rank 1
Answers by
robertw102
Top achievements
Rank 1
Rita15
Top achievements
Rank 1
Tsvetoslav
Telerik team
Share this question
or