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

When clicking on ajax.actionlink in its oncomplete function I can't update the html of a div whith requested data - partial view with radcombobox

1 Answer 192 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Tanya
Top achievements
Rank 1
Tanya asked on 01 Jun 2014, 10:22 AM
In one mvc partial view I've got some ajax.ActionLinks which when clicked update the div 'importpartupdate' (they just updates the div whith new ajax.actionLinks with other routevalues). The problem is that when this update is competed I have to update another div - depending on which link is clicked . That's why in my OnComplete function of my ajax.ActionLink I make an ajax request to the action 'GridViewLanguage' which returns me the partial view which should uodate this other div with  claass .floatLanguage.

The partial view which action Gridviewlanguage retuns me is just am user control with radgridcombobox. It as you see has an Itemtemplate with an anchor element 
with href property <a href="<%#DataBinder.Eval(Container.DataItem, "menuID")%>">  and I see that the menuID item has each time proper value. 



<telerik:RadGrid ID="RadGridLang" runat="server" AutoGenerateColumns="False"  EnableEmbeddedSkins="False"  RegisterWithScriptManager=false <br>                 DataTextField="Descr" DataValueField="LanImg"<br>                Height="100%" Width="120px" AppendDataBoundItems="true" CellSpacing="0" GridLines="None" OnLoad="RadGridLang_Load"><br>                <MasterTableView><br>                    <Columns><br>                        <telerik:GridTemplateColumn DataField="LanCd"><br>                            <ItemTemplate><br>                                <img src="<%#DataBinder.Eval(Container.DataItem, "LanImg")%>" alt="ASP.NET hosting" /><br>                            </ItemTemplate><br>                        </telerik:GridTemplateColumn><br>                        <telerik:GridTemplateColumn DataField="LanCd"><br>                            <ItemTemplate><br>                                <telerik:RadComboBox ID="RadComboBoxLang" runat="server" EmptyMessage="Select a language" DataTextField="Descr" DataValueField="LanCd" EnableEventValidation="true"  RegisterWithScriptManager=false <br>                                    EnableLoadOnDemand="true" DataSourceID="ObjectDataSourceDrob" CausesValidation="false" AllowCustomText="true" AppendDataBoundItems="true" OnLoad="RadComboBoxLang_Load" ><br>                                     <ItemTemplate><br>                                        <div class="imageWrap"><br>                                           <telerik:RadComboBoxItem Text="Select" /><br>                                        <a href="<%#DataBinder.Eval(Container.DataItem, "menuID")%>">                                            <br>                                            <img src="<%#DataBinder.Eval(Container.DataItem, "LanImg")%>" alt='<%# Eval("Descr")%>'/>&nbsp&nbsp&nbsp&nbsp&nbsp<%#DataBinder.Eval(Container.DataItem, "Descr")%></a><br>                                        </div><br>                                       <br>                                    </ItemTemplate><br>                                </telerik:RadComboBox><br>                            </ItemTemplate><br>                        </telerik:GridTemplateColumn><br>                    </Columns><br>                </MasterTableView><br>            </telerik:RadGrid>

                                                                                   
   



So the first time when I click a link eeverything works correctly and my two divs are correctly updated. But the second time I click a new link it seems the the floatlanguuage div is not updated - and the href property in the anchor element stays the same as the previous request. Can you suggest why teh value in the href property in the link in the radcombobox stays the same 

like somehow the browser is caching the previous info I don't know. \i tried with cache:false- nothing worked.

Here is my view partial view which makes request to the action after a ajax.actionlink is clicked 

<div class="importpartupdate"><br>        <ul><br>            @{<br>                if (Model != null)<br>                {<br>                    foreach (MvcBeaDAL.WebServiceBeaMenu item in Model.MenuLeft)<br>                    {<br><br>                      <li><br>                        @Ajax.ActionLink(@item.SpecialWord, "ImportShow", new { id = Model.LanguageName, menuID = item.ID, articlegroupID = item.ArticlegroupID, counter = 1 }, new AjaxOptions { UpdateTargetId = "importPartUpdate", HttpMethod = "GET", InsertionMode = InsertionMode.Replace, OnComplete = "success("+@item.ID+")" }, new { id=item.ID})<br><br>                      </li> <br>                    }<br>                } <br>            }<br>        </ul><br>    </div> <br><br><br></nav><br>   <script><br>       function success(ids) {<br><br>           var nocache = new Date().getTime(); <br><br>           jQuery.ajax({<br>                url: '@Url.Action("GridLanguageView")/?menuID='+ids<br><br><br>           }).done(function (data)<br>           {<br><br><br>             $(".floatLanguage").replaceWith(data);<br>             alert(data);<br>           });<br><br><br><br>       }<br>     </script>

1 Answer, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 03 Jun 2014, 01:29 PM
Hi Tanya,

Ajax components are not designed for MVC, so it is possible to experience different issues on this 
framework. Can you attach a runnable sample project, so we can debug and troubleshoot the problem.

Thanks.

Regards,
Hristo Valyavicharski
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
ComboBox
Asked by
Tanya
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
Share this question
or