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

[Solved] ajaxRequest - No partial page update

1 Answer 104 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Stuart
Top achievements
Rank 1
Stuart asked on 02 Jul 2009, 03:41 PM
Hi,

I have two grids, deleting an item from one grid pops up a radprompt for a deletion reason before a ajaxRequest is called to mark the record as deleted on the server. I then get both grids to rebind however the grids are then not being updated.

The AjaxManager declaration:

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1"

 

EnableAJAX="True" onajaxrequest="RadAjaxManager1_AjaxRequest" >

 

<AjaxSettings>

 

<telerik:AjaxSetting AjaxControlID="RadGridInStock">

 

<UpdatedControls>

 

<telerik:AjaxUpdatedControl ControlID="RadGridInStock" LoadingPanelID="RadAjaxLoadingPanel1" />

 

<telerik:AjaxUpdatedControl ControlID="RadGridDeleted" LoadingPanelID="RadAjaxLoadingPanel1" />

 

</UpdatedControls>

 

 

</telerik:AjaxSetting>

On the top grid is a column to trigger the delete:

 

<telerik:GridTemplateColumn UniqueName="DeleteLink">

 

 

<ItemTemplate>

 

 

<asp:LinkButton ID="DeleteLink" runat="server" Text="Delete" />

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

 

I associate the javascript with the column with this code:

 

 

protected void RadGridInStock_ItemCreated(object sender, GridItemEventArgs e)

{

 

if (e.Item is GridDataItem)

{

 

GridDataItem item = e.Item as GridDataItem;

 

 

LinkButton button = item["DeleteLink"].Controls[1] as LinkButton;

 

 

APO_Vehicle vehicle = item.DataItem as APO_Vehicle;

 

 

if (vehicle != null)

{

button.Attributes.Add(

 

"onclick",

 

 

String.Format("return deleteClick({0});",

vehicle.Id));

}

}

}

 

This calls this javascript:

 

 

var deleteId;

 

 

function deleteClick(id) {

deleteId = id;

radprompt(

 

'What is your reason for deleting this car?', promptCallBackFn, 330, 100);

 

 

return false;

}

 

 

function promptCallBackFn(args) {

 

 

// Call an ajax method to delete the record

 

if (args != null && args.length > 0) {

 

var arguments;

arguments.id = deleteId;

arguments.reason = args;

$find(

 

"<%=RadAjaxManager1.ClientID%>").ajaxRequest('{ "id" : ' + arguments.id + ', "reason" : "' + arguments.reason + '" }');

}

}

 

 

The Ajax request code is as follows:

 

 

protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)

{

 

// Code to delete record from db ..

 RadGridInStock.Rebind();

RadGridDeleted.Rebind();

}

 

 

Is there a way to get the RadAjaxManager to update the grids from the AjaxRequest method? I kind of thought this should happen automatically.

Thanks,

Stuart

 

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 06 Jul 2009, 01:05 PM
Hi Stuart,

Try adding the below ajax setting to your manager and see if it makes any difference:

<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">  
    <UpdatedControls> 
        <telerik:AjaxUpdatedControl ControlID="RadGridInStock" LoadingPanelID="RadAjaxLoadingPanel1" /> 
        <telerik:AjaxUpdatedControl ControlID="RadGridDeleted" LoadingPanelID="RadAjaxLoadingPanel1" /> 
    </UpdatedControls> 
</telerik:AjaxSetting> 

Let me know how it goes.

Kind regards,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Ajax
Asked by
Stuart
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or