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

[Solved] Ajaxifying grid is not working properly

2 Answers 179 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
shamley
Top achievements
Rank 1
shamley asked on 07 May 2008, 02:06 PM
Hi,

  I have a search textbox and button on page. Grid is also on same page. I need to refresh it everytime user clicks on serach button. Thing is I am only retriving 20 rows at a time and using VirtualItemCount to page thru others. On dgUsers_ItemDataBound I have to use Class objects and get some values to assign to hypUserId. Ajax doesn't work when I create a new instance of class.  It doesn't refresh when I remove alert('hi') and when it works without alert and class, it doesn't always refreshes grid. What I am doing wrong?
Pls. help..

This is the code I am using on button click.

$find(

"<%=AjaxManager.ClientID%>").ajaxRequest("SEARCH");
alert(
'hi');

Ajax manager settings -

<

telerik:RadAjaxManager ID="AjaxManager" runat="server" OnAjaxRequest="AjaxManager_AjaxRequest">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="AjaxManager">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="panel"  />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="btnSearch">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="panel"  />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>

And this is the grid.

<

asp:PlaceHolder id="panel" runat="server">
<telerik:RadGrid ID="dgUsers" runat="server" AllowCustomPaging="true" AllowMultiRowSelection="false"AllowPaging="True" AllowSorting="false" AutoGenerateColumns="false" OnItemDataBound="dgUsers_ItemDataBound"
OnNeedDataSource="dgUsers_NeedDataSource" OnPageIndexChanged="dgUsers_PageIndexChanged" PageSize="20" Visible="false">
<PagerStyle mode="NumericPages" AlwaysVisible="true" />
<MasterTableView><Columns>
<telerik:GridTemplateColumn HeaderText="User ID" UniqueName="PersonId">
<ItemTemplate >
<asp:HyperLink ID="hypUserId" runat="server"></asp:HyperLink>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Email" UniqueName="email">
<ItemTemplate>
<asp:Label ID="lblEmail" runat="server"></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:radgrid>
</asp:PlaceHolder>

thanks.

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 07 May 2008, 02:58 PM
Hello shamley,

I tried this and everything worked fine on my end - you can find an example project attached.

Sincerely yours,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
shamley
Top achievements
Rank 1
answered on 07 May 2008, 07:14 PM
Thanks. But I was having problem with that code. and I managed to resolve it by using ajaxRequestWithTarget.
 
var ajaxManager = $find("<%= AjaxManager.ClientID %>");ajaxManager.ajaxRequestWithTarget('<%= button.UniqueID %>', '');

Tags
Ajax
Asked by
shamley
Top achievements
Rank 1
Answers by
Vlad
Telerik team
shamley
Top achievements
Rank 1
Share this question
or