
function refreshGrid(arg) {
if (!arg) {
$find(
"<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
}
else {
$find(
"<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");
}
}
in the vb pages i have the following code:
Protected
Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest
If e.Argument = "Rebind" Then
RadGrid1.Rebind()
ElseIf e.Argument = "RebindAndNavigate" Then
RadGrid1.MasterTableView.CurrentPageIndex = RadGrid1.MasterTableView.PageCount
RadGrid1.Rebind()
End If
End Sub
I have set RadAjaxManager1 to update RadGrid1 in the RadAjaxManager but get the error - does anyone have an idea why this happens? The database is being updated and the grid displays the correct data once the page is refreshed.
Many thanks in advance
Steve :o)
| <telerik:RadComboBox ID="cboCities" runat="server" AutoPostBack="True" EnableLoadOnDemand="True" |
| EnableVirtualScrolling="True" Height="200px" MarkFirstMatch="True" |
| OnClientItemsRequesting="OnClientItemsRequesting" |
| OnItemsRequested="cboCities_ItemsRequested" Filter="None" ShowMoreResultsBox="True" |
| Width="240px" Font-Size="X-Small" AllowCustomText="True" |
| EmptyMessage="Type a city name" Skin="Black"> |
| <CollapseAnimation Duration="200" Type="OutQuint" /> |
| </telerik:RadComboBox> |
| function OnClientItemsRequesting(sender,e) |
| { |
| if(sender.get_appendItems()) |
| e.get_context().CustomText=""; |
| else |
| e.get_context().CustomText=sender.get_text(); |
| } |
| Protected Sub cboCities_ItemsRequested(ByVal sender As Object, ByVal e As RadComboBoxItemsRequestedEventArgs) |
| Dim sql As String = "Select cityCode,cityName,State,Lat,Long from s_CityMaster WHERE Cityname LIKE '%" + e.Context("CustomText").ToString() + "%' ORDER BY CityName" |
| Dim adapter As New SqlDataAdapter(sql, ConfigurationManager.AppSettings("BioDiasporaCS")) |
| Dim data As New DataTable() |
| adapter.Fill(data) |
| Try |
| Dim itemsPerRequest As Integer = 10 |
| Dim itemOffset As Integer = e.NumberOfItems |
| Dim endOffset As Integer = itemOffset + itemsPerRequest |
| If endOffset > data.Rows.Count Then |
| endOffset = data.Rows.Count |
| End If |
| If endOffset = data.Rows.Count Then |
| e.EndOfItems = True |
| End If |
| Dim i As Integer = itemOffset |
| While i < endOffset |
| cboCities.Items.Add(New RadComboBoxItem(data.Rows(i)("cityName").ToString(), data.Rows(i)("cityName").ToString())) |
| i = i + 1 |
| End While |
| If data.Rows.Count > 0 Then |
| e.Message = [String].Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), data.Rows.Count.ToString()) |
| Else |
| e.Message = "No matches" |
| End If |
| Catch |
| e.Message = "No matches" |
| End Try |
| End Sub |