Hello,
I am very new to ASP.Net, and I'm sure that my problem has more to do with how I implemented the updatepanel, rather than how I implemented the grid.
I have a page with two UpdatePanels. The first holds a bunch of dropdowns that get changed whenever a selection is changed. The second UpdatePanel holds a button and a RadGrid. When someone hits the button, the server is supposed to perform a query and update the grid's databinding.
Instead, when I hit the button, a second identical grid appears right next to the first one. The original grid gets the data, and the duplicate grid has no data. If I hit the button again, I get the error, "Uncaught Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: Invalid JSON primitive: ."
aspx:
cs file:
I am very new to ASP.Net, and I'm sure that my problem has more to do with how I implemented the updatepanel, rather than how I implemented the grid.
I have a page with two UpdatePanels. The first holds a bunch of dropdowns that get changed whenever a selection is changed. The second UpdatePanel holds a button and a RadGrid. When someone hits the button, the server is supposed to perform a query and update the grid's databinding.
Instead, when I hit the button, a second identical grid appears right next to the first one. The original grid gets the data, and the duplicate grid has no data. If I hit the button again, I get the error, "Uncaught Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: Invalid JSON primitive: ."
aspx:
<%@ Page Title="Find Location" Language="C#" MasterPageFile="~/Site.Master"
AutoEventWireup="true" CodeBehind="FindLocation.aspx.cs" Inherits="Project1.FindLocation" %>
<
br
>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %><
br
>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Charting" Assembly="Telerik.Web.UI" %><
br
>
<
asp:Content
ID
=
"HeadContent"
ContentPlaceHolderID
=
"HeadContentPH"
runat
=
"server"
><
br
>
</
asp:Content
><
br
>
<
asp:Content
ID
=
"MainContent"
ContentPlaceHolderID
=
"MainContentPH"
runat
=
"server"
><
br
>
<
div
style
=
"float: left; padding: 15px;"
><
br
>
<
h2
><
br
>
Find Location</
h2
><
br
>
<
asp:UpdatePanel
ID
=
"FindLocationUpdatePnl"
runat
=
"server"
UpdateMode
=
"Conditional"
><
br
>
<
ContentTemplate
><
br
>
<
table
><
br
>
<
tr
><
br
>
<
td
><
br
>
<
fieldset
><
br
>
<
legend
>General</
legend
><
br
>
<
table
width
=
"100%"
><
br
>
<
tr
><
br
>
<
td
><
br
>
Custom Identifier<
br
>
</
td
><
br
>
<
td
><
br
>
<
telerik:RadTextBox
ID
=
"m_oCustomIdTextBox"
runat
=
"server"
><
br
>
</
telerik:RadTextBox
><
br
>
</
td
><
br
>
</
tr
><
br
>
<
tr
><
br
>
<
td
><
br
>
Owned by<
br
>
</
td
><
br
>
<
td
><
br
>
<
telerik:RadComboBox
ID
=
"m_oOwnedByComboBox"
runat
=
"server"
AutoPostBack
=
"false"
<br>
EnableViewState="true"><
br
>
</
telerik:RadComboBox
><
br
>
</
td
><
br
>
</
tr
><
br
>
<
tr
><
br
>
<
td
><
br
>
Maintained by<
br
>
</
td
><
br
>
<
td
><
br
>
<
telerik:RadComboBox
ID
=
"m_oMaintainedByComboBox"
runat
=
"server"
OnSelectedIndexChanged
=
"MaintainedByChanged"
<br>
EnableViewState="true" AutoPostBack="true"><
br
>
</
telerik:RadComboBox
><
br
>
</
td
><
br
>
</
tr
><
br
>
</
table
><
br
>
</
fieldset
><
br
>
</
td
><
br
>
<
td
><
br
>
<
fieldset
><
br
>
<
legend
>Has Route</
legend
><
br
>
<
table
width
=
"100%"
><
br
>
<
tr
><
br
>
<
td
><
br
>
Type<
br
>
</
td
><
br
>
<
td
><
br
>
<
telerik:RadComboBox
ID
=
"m_oHasRouteTypeComboBox"
runat
=
"server"
AutoPostBack
=
"true"
<br>
EnableViewState="true" /><
br
>
</
td
><
br
>
</
tr
><
br
>
<
tr
><
br
>
<
td
><
br
>
Name or Number<
br
>
</
td
><
br
>
<
td
><
br
>
<
telerik:RadComboBox
ID
=
"m_oNameOrNumber1"
runat
=
"server"
AutoPostBack
=
"true"
EnableViewState
=
"true"
/><
br
>
</
td
><
br
>
</
tr
><
br
>
</
table
><
br
>
</
fieldset
><
br
>
</
td
><
br
>
</
tr
><
br
>
<
tr
><
br
>
<
td
><
br
>
<
fieldset
><
br
>
<
legend
>Region</
legend
><
br
>
<
table
width
=
"100%"
><
br
>
<
tr
><
br
>
<
td
><
br
>
County<
br
>
</
td
><
br
>
<
td
><
br
>
<
telerik:RadComboBox
ID
=
"m_oCountyComboBox"
runat
=
"server"
OnSelectedIndexChanged
=
"CountyChanged"
<br>
AutoPostBack="true" EnableViewState="true" /><
br
>
</
td
><
br
>
</
tr
><
br
>
<
tr
><
br
>
<
td
><
br
>
City<
br
>
</
td
><
br
>
<
td
><
br
>
<
telerik:RadComboBox
ID
=
"m_oCityComboBox"
runat
=
"server"
OnSelectedIndexChanged
=
"CityChanged"
<br>
AutoPostBack="true" EnableViewState="true" /><
br
>
</
td
><
br
>
</
tr
><
br
>
<
tr
><
br
>
<
td
><
br
>
<
br
>
</
td
><
br
>
</
tr
><
br
>
</
table
><
br
>
</
fieldset
><
br
>
</
td
><
br
>
<
td
><
br
>
<
fieldset
><
br
>
<
legend
>And Has Route</
legend
><
br
>
<
table
width
=
"100%"
><
br
>
<
tr
><
br
>
<
td
><
br
>
Type<
br
>
</
td
><
br
>
<
td
><
br
>
<
telerik:RadComboBox
ID
=
"m_oAndHasRouteTypeComboBox"
runat
=
"server"
AutoPostBack
=
"true"
<br>
EnableViewState="true" /><
br
>
</
td
><
br
>
</
tr
><
br
>
<
tr
><
br
>
<
td
><
br
>
Name or Number<
br
>
</
td
><
br
>
<
td
><
br
>
<
telerik:RadComboBox
ID
=
"m_oNameOrNumber2"
runat
=
"server"
AutoPostBack
=
"true"
EnableViewState
=
"true"
/><
br
>
</
td
><
br
>
</
tr
><
br
>
</
table
><
br
>
</
fieldset
><
br
>
</
td
><
br
>
</
tr
><
br
>
</
table
><
br
>
</
ContentTemplate
><
br
>
</
asp:UpdatePanel
><
br
>
<!-- Buttons -->
<
br
>
<
asp:UpdatePanel
runat
=
"server"
UpdateMode
=
"Conditional"
><
br
>
<
ContentTemplate
><
br
>
<
div
><
br
>
<
telerik:RadButton
ID
=
"m_oSearchBtn"
runat
=
"server"
Text
=
"Search"
OnClick
=
"FindLocations"
/><
br
>
</
div
><
br
>
</
div
><
br
>
<
div
style
=
"float: left; padding: 15px;"
><
br
>
<
telerik:RadGrid
ID
=
"m_oRadGrid"
AllowPaging
=
"true"
PageSize
=
"3"
runat
=
"server"
AutoGenerateColumns
=
"False"
<br>
DataSourceID="m_oFoundLocationsSource" HorizontalAlign="NotSet"><
br
>
<
MasterTableView
DataSourceID
=
"m_oFoundLocationsSource"
><
br
>
<
Columns
><
br
>
<
telerik:GridBoundColumn
DataField
=
"CustomIdentifier"
HeaderText
=
"Custom Identifier"
<br>
DataType="System.String" UniqueName="CustomIdentifier"><
br
>
</
telerik:GridBoundColumn
><
br
>
</
Columns
><
br
>
</
MasterTableView
><
br
>
</
telerik:RadGrid
><
br
>
</
ContentTemplate
><
br
>
</
asp:UpdatePanel
><
br
>
<
asp:ObjectDataSource
ID
=
"m_oFoundLocationsSource"
runat
=
"server"
SelectMethod
=
"GetFoundLocations"
<br>
EnablePaging="true" StartRowIndexParameterName="iStartRecord" MaximumRowsParameterName="iMaxRecords"<
br
>
SortParameterName="sSortColumns" DataObjectTypeName="PersistenceLayer.Location"<
br
>
TypeName="Project1.FindLocation" OldValuesParameterFormatString="original_{0}"></
asp:ObjectDataSource
><
br
>
</
div
><
br
>
</
asp:Content
>
cs file:
using
System;<br>
using
System.Collections.Generic;<br>
using
System.Linq;
using
System.Web;
using
System.Web.UI;<br>
using
System.Web.UI.WebControls;<br>
using
PersistenceLayer;<br>
using
Project1.Helpers;<br>
using
<font style=
"font-size: 14px; "
>Project1</font>.Cache;<br>
using
System.Collections.ObjectModel;<br>
using
Telerik.Web.UI;<br>
<br>
<br>
namespace
Project1<br>
{<br>
public
partial
class
FindLocation : System.Web.UI.Page<br>
{<br>
#region Event Handlers<br>
<br>
<br>
#region Page Init<br>
<br>
<br>
protected
void
Page_Load(
object
sender, EventArgs e)<br>
{<br>
if
(IsPostBack ==
false
)<br>
{<br>
<font
class
=
"Apple-tab-span"
style=
"white-space: pre; "
> </font>
//initialize drop down content<br>
}<br>
}<br>
<br>
<br>
#endregion<br>
<br>
<br>
#region Filter Logic<br>
<br>
<br>
protected
void
MaintainedByChanged(
object
sender, EventArgs e)<br>
{<br>
//change dropdown content<br>
}<br>
<br>
<br>
protected
void
CountyChanged(
object
sender, EventArgs e)<br>
{<br>
//change dropdown content<br>
}<br>
<br>
<br>
protected
void
CityChanged(
object
sender, EventArgs e)<br>
{<br>
//change dropdown content<br>
}<br>
<br>
<br>
protected
void
FindLocations(
object
sender, EventArgs e)<br>
{<br>
<font
class
=
"Apple-tab-span"
style=
"white-space: pre; "
> </font>
//get data from drop downs<br>
ServerSessionCache.FoundLocations = PerformSearch(sCustomId, gOwnedById, gMaintainedById, gCountyId, gCityId);<br>
m_oRadGrid.Rebind();<br>
}<br>
<br>
<br>
#endregion<br>
<br>
<br>
#region RadGrid Logic<br>
<br>
<br>
public
static
IList<Location> GetFoundLocations(
string
sSortColumns,
int
iMaxRecords,
int
iStartRecord)<br>
{<br>
return
ServerSessionCache.FoundLocations;<br>
}<br>
<br>
<br>
#endregion<br>
<br>
<br>
#endregion<br>
<br>
<br>
#region Methods<br>
<br>
<br>
public
IList<Location> PerformSearch(
string
sCustomId, Guid gOwnedById, Guid gMaintainedById, Guid gCountyId, Guid gCityId)<br>
{<br>
//use data to perform query, store in oLocations<br>
<br>
<br>
return
oLocations;<br>
}<br>
<br>
<br>
#endregion<br>
}<br>
}