What could cause Advanced paging to not work?
The above PagerStyle outputs NextPrevAndNumeric controls, there are no advanced controls. If I change mode to Advanced, nothing shows up in the footer. I'm using 2010 Q1, but I've also updated to 2011 Q1 and get the same results.
<
telerik:RadGrid
ID
=
"grdTicket"
runat
=
"server"
AutoGenerateColumns
=
"false"
Width
=
"946px"
Font-Names
=
"Verdana"
Font-Size
=
"x-small"
EnableViewState
=
"true"
AllowSorting
=
"true"
AllowPaging
=
"true"
AllowMultiRowSelection
=
"false"
OnNeedDataSource
=
"grdTicket_NeedDataSource"
OnPageIndexChanged
=
"grdTicket_PageIndexChanged"
>
<
MasterTableView
Width
=
"100%"
NoDetailRecordsText
=
"No Records To Display"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"origdtdate"
HeaderText
=
"Call In Date"
ReadOnly
=
"true"
SortExpression
=
"origdtdate"
></
telerik:GridBoundColumn
>
<
telerik:GridHyperLinkColumn
DataTextField
=
"ticketnum"
HeaderText
=
"Ticket#"
SortExpression
=
"ticketnum"
DataNavigateUrlFields
=
"ticketnum"
DataNavigateUrlFormatString
=
"SearchViewTicket.aspx?ticketnum={0}"
></
telerik:GridHyperLinkColumn
>
<
telerik:GridBoundColumn
DataField
=
"address"
HeaderText
=
"Address"
ReadOnly
=
"true"
SortExpression
=
"address"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"street"
HeaderText
=
"Street"
ReadOnly
=
"true"
SortExpression
=
"street"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"city"
HeaderText
=
"City"
ReadOnly
=
"true"
SortExpression
=
"city"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"county"
HeaderText
=
"County"
ReadOnly
=
"true"
SortExpression
=
"county"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"company"
HeaderText
=
"Contractor"
ReadOnly
=
"true"
SortExpression
=
"company"
></
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
<
PagerStyle
Mode
=
"NextPrevNumericAndAdvanced"
ShowPagerText
=
"true"
/>
</
telerik:RadGrid
>
The above PagerStyle outputs NextPrevAndNumeric controls, there are no advanced controls. If I change mode to Advanced, nothing shows up in the footer. I'm using 2010 Q1, but I've also updated to 2011 Q1 and get the same results.
3 Answers, 1 is accepted
0
Hello Brian,
I tried to replicate the issue which you described, but to no avail.
Attached to this message, you will find the code which I used for testing.
Please, take a look at it and let me know if there are any differences at your end, which I may be leaving out.
Kind regards,
Mira
the Telerik team
I tried to replicate the issue which you described, but to no avail.
Attached to this message, you will find the code which I used for testing.
Please, take a look at it and let me know if there are any differences at your end, which I may be leaving out.
Kind regards,
Mira
the Telerik team
0

bdk0172
Top achievements
Rank 1
answered on 28 Mar 2011, 04:24 PM
Your sample works fine. For the most part, I'm following the examples for advanced binding. I'm attaching the code from the aspx and cs files in the hopes that you might see something that could cause this. The reason I am using two grids is the one with paging is displayed to the user and the one without is used for if the user wants to print the contents of the grid. I had tried to follow the example from your website on printing the full contents of a grid with paging, but had some issues so decided to go this route instead.
<%@ Page Language="C#" MasterPageFile="~/Search/MasterSearchPage.master" AutoEventWireup="true" CodeFile="Search.aspx.cs" Inherits="Search" Title="Ticket Response" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%--<%@ Register Assembly="Vortex.Web.UI.WebControls" Namespace="Vortex.Web.UI.WebControls" TagPrefix="vortex" %>
--%>
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"ContentPlaceHolder1"
Runat
=
"Server"
>
<
ajax:ScriptManager
ID
=
"s1"
EnablePartialRendering
=
"true"
runat
=
"server"
/>
<%--<
script
src
=
"JScript.js"
></
script
>
--%>
<
script
type
=
"text/javascript"
>
function pnlRequestStarted(ajaxPanel, eventArgs)
{
if (eventArgs.EventTarget.indexOf("ibExport") != -1)
{
eventArgs.EnableAjax = false;
}
}
function displayInfoDiv(display)
{
var div = document.getElementById('<%=divInfo.ClientID %>');
if (display)
div.style.display = 'inline';
else
div.style.display = 'none';
}
function displayDateInfoDiv(display)
{
var div = document.getElementById('<%=divDates.ClientID %>');
if (display)
div.style.display = 'inline';
else
div.style.display = 'none';
}
function StartCallback(row)
{
var strData = row - 1;
CallServer(strData, "");
}
function ReceiveCallback(strReturnData)
{
// do nothing
// document.title = strReturnData;
// returnData = strReturnData;
}
function openVideoSite()
{
var url = document.getElementById('<%=hiddenUrl.ClientID %>');
window.open(url.value);
}
function PrintRadGrid()
{
var div = document.getElementById('divGrid');
div.style.display = 'block';
var radGrid = $find('<%=grdDuplicate.ClientID %>');
var previewWnd = window.open('about:blank', '', '', false);
var sh = '<%= ClientScript.GetWebResourceUrl(grdDuplicate.GetType(),String.Format("Telerik.Web.UI.Skins.{0}.Grid.{0}.css",grdDuplicate.Skin)) %>';
var styleStr = "<
html
><
head
><
link
href
=
'" + sh + "'
rel
=
'stylesheet'
type
=
'text/css'
></
link
></
head
>";
var htmlcontent = styleStr + "<
body
>" + radGrid.get_element().outerHTML + "</
body
></
html
>";
previewWnd.document.open();
previewWnd.document.write(htmlcontent);
previewWnd.document.close();
previewWnd.print();
previewWnd.close();
div.style.display = 'none';
}
function ibClear_Click()
{
document.getElementById('<%=txtTicketnum.ClientID %>').value = '';
document.getElementById('<%=txtAddress.ClientID %>').value = '';
document.getElementById('<%=txtStreet.ClientID %>').value = '';
document.getElementById('<%=txtCity.ClientID %>').value = '';
document.getElementById('<%=txtCompany.ClientID %>').value = '';
document.getElementById('<%=txtCounty.ClientID %>').value = '';
document.getElementById('<%=ddMemberCode.ClientID %>').value = '';
var datepicker = $find("<%= calFromDate.ClientID %>");
datepicker.clear();
datepicker = $find("<%= calThruDate.ClientID %>");
datepicker.clear();
return false;
}
</
script
>
<
div
id
=
"mainContent"
style
=
"padding-top:5px; padding-bottom:20px; text-align:center; border:solid 1px gray; background-color:White; width:1000px; min-height:700px;"
>
<
center
>
<
div
id
=
"Pdiv1"
align
=
"left"
style
=
"left: 0px; position: relative; width: 950px; top: 0px; font-size:x-small;"
>
<
div
style
=
"width:100%;"
>
<
div
style
=
"float:left;"
>
<
asp:Image
ID
=
"header"
runat
=
"server"
AlternateText
=
"Ticket Search"
ImageUrl
=
"~/App_Themes/images/ticketsearch.jpg"
/>
</
div
>
<
div
style
=
"float:right;"
>
<
asp:ImageButton
ID
=
"ibVideo"
runat
=
"server"
OnClientClick
=
"openVideoSite();"
ImageUrl
=
"~/App_Themes/images/view_training_video.jpg"
/>
<
asp:HiddenField
ID
=
"hiddenUrl"
runat
=
"server"
/>
</
div
>
</
div
>
<
div
style
=
"clear:both; float:none;"
></
div
>
<
asp:Panel
ID
=
"pnlSearch"
runat
=
"server"
Width
=
"950px"
HorizontalAlign
=
"left"
DefaultButton
=
"btnSearch"
>
<
table
>
<
tr
>
<
td
>
<
asp:Label
ID
=
"Label10"
Text
=
"Search status and positive responses by entering the ticket number or any of the other criteria listed below."
runat
=
"server"
Font-Names
=
"Verdana"
></
asp:Label
>
<
img
src
=
"../App_Themes/images/information.gif"
onmouseover
=
"displayInfoDiv(true);"
onmouseout
=
"displayInfoDiv(false);"
/>
<
div
id
=
"divInfo"
runat
=
"server"
style="display:none; border:solid 1px gray; background-color:White; font-family:Verdana; font-size:x-small;
width:150px; position:absolute; z-index:1000; padding:5px 5px 5px 5px;">
This criteria includes any, or all, of the street address, street name, city, county or company.
</
div
>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
br
/>
<
hr
id
=
"HR4"
style
=
"width: 100%"
class
=
"colorScheme"
/>
</
td
>
</
tr
>
</
table
>
<
table
>
<
tr
>
<
td
>
<
asp:Label
ID
=
"Label5"
Text
=
"Ticket Number:"
Width
=
"120"
runat
=
"server"
Font-Names
=
"Verdana"
></
asp:Label
>
</
td
>
<
td
>
<
asp:TextBox
ID
=
"txtTicketnum"
runat
=
"server"
Width
=
"200px"
Font-Names
=
"Verdana"
></
asp:TextBox
>
</
td
>
<
td
>
<
asp:CompareValidator
ID
=
"cvTicketnum"
runat
=
"server"
ControlToValidate
=
"txtTicketnum"
ErrorMessage
=
"Please enter numbers only."
Operator
=
"DataTypeCheck"
SetFocusOnError
=
"True"
Type
=
"Integer"
Font-Names
=
"Verdana"
></
asp:CompareValidator
>
</
td
>
</
tr
>
</
table
>
<
table
>
<
tr
>
<
td
>
<
asp:Label
ID
=
"Label1"
Text
=
"Street Addr:"
width
=
"120"
runat
=
"server"
Font-Names
=
"Verdana"
></
asp:Label
>
</
td
>
<
td
style
=
"width:100px"
>
<
asp:TextBox
ID
=
"txtAddress"
runat
=
"server"
Width
=
"75px"
Font-Names
=
"Verdana"
MaxLength
=
"31"
></
asp:TextBox
>
</
td
>
<
td
style
=
"text-align:right"
>
<
asp:Label
ID
=
"Label9"
Text
=
"Street Name:"
Width
=
"100"
runat
=
"server"
Font-Names
=
"Verdana"
></
asp:Label
>
</
td
>
<
td
>
<
asp:TextBox
ID
=
"txtStreet"
runat
=
"server"
Width
=
"200px"
Font-Names
=
"Verdana"
MaxLength
=
"31"
></
asp:TextBox
>
<
asp:CompareValidator
ID
=
"cvAddress"
runat
=
"server"
ControlToValidate
=
"txtAddress"
ErrorMessage
=
"Please enter numbers only."
Operator
=
"DataTypeCheck"
SetFocusOnError
=
"True"
Type
=
"Integer"
Font-Names
=
"Verdana"
></
asp:CompareValidator
>
<%--<
asp:RegularExpressionValidator
ID
=
"rvStreet"
runat
=
"server"
ControlToValidate
=
"txtStreet"
ErrorMessage
=
"Please enter letters only."
Font-Names
=
"Verdana"
SetFocusOnError
=
"True"
ValidationExpression
=
"[a-zA-Z\s]*"
></
asp:RegularExpressionValidator
>--%>
</
td
>
</
tr
>
</
table
>
<
table
>
<
tr
>
<
td
>
<
asp:Label
ID
=
"Label18"
Text
=
"City:"
width
=
"120"
runat
=
"server"
Font-Names
=
"Verdana"
></
asp:Label
>
</
td
>
<
td
>
<
asp:TextBox
ID
=
"txtCity"
runat
=
"server"
Width
=
"200px"
Font-Names
=
"Verdana"
MaxLength
=
"16"
></
asp:TextBox
>
<%--<
asp:RegularExpressionValidator
ID
=
"rvCounty"
runat
=
"server"
ControlToValidate
=
"txtCounty"
ErrorMessage
=
"Please enter letters only."
Font-Names
=
"Verdana"
SetFocusOnError
=
"True"
ValidationExpression
=
"[a-zA-Z\s]*"
></
asp:RegularExpressionValidator
>--%>
</
td
>
<
td
>
<
asp:Label
ID
=
"Label3"
Text
=
"County:"
width
=
"60"
runat
=
"server"
Font-Names
=
"Verdana"
></
asp:Label
>
</
td
>
<
td
>
<
asp:TextBox
ID
=
"txtCounty"
runat
=
"server"
Width
=
"134px"
Font-Names
=
"Verdana"
MaxLength
=
"19"
></
asp:TextBox
>
<%--<
asp:RegularExpressionValidator
ID
=
"rvCounty"
runat
=
"server"
ControlToValidate
=
"txtCounty"
ErrorMessage
=
"Please enter letters only."
Font-Names
=
"Verdana"
SetFocusOnError
=
"True"
ValidationExpression
=
"[a-zA-Z\s]*"
></
asp:RegularExpressionValidator
>--%>
</
td
>
</
tr
>
</
table
>
<%-- <
hr
id
=
"HR3"
style
=
"width: 950px"
color
=
"#ff9933"
/>
--%>
<
table
>
<
tr
>
<
td
>
<
asp:Label
ID
=
"Label8"
Text
=
"Company:"
Width
=
"120"
runat
=
"server"
Font-Names
=
"Verdana"
></
asp:Label
>
</
td
>
<
td
>
<
asp:TextBox
ID
=
"txtCompany"
runat
=
"server"
Width
=
"200px"
Font-Names
=
"Verdana"
MaxLength
=
"31"
></
asp:TextBox
>
<
asp:RegularExpressionValidator
ID
=
"rvCompany"
runat
=
"server"
ControlToValidate
=
"txtCompany"
ErrorMessage
=
"Please enter letters only."
Font-Names
=
"Verdana"
SetFocusOnError
=
"True"
ValidationExpression
=
"[0-9a-zA-Z\s]*"
></
asp:RegularExpressionValidator
>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
asp:Label
runat
=
"server"
Text
=
"Member Code:"
Font-Names
=
"Verdana"
></
asp:Label
>
</
td
>
<
td
>
<
asp:DropDownList
ID
=
"ddMemberCode"
runat
=
"server"
Width
=
"200px"
Font-Names
=
"Verdana"
></
asp:DropDownList
>
</
td
>
</
tr
>
</
table
>
<
table
>
<
tr
>
<
td
>
<
asp:Label
ID
=
"Label6"
Text
=
"Date Range: From"
width
=
"120"
runat
=
"server"
Font-Names
=
"Verdana"
></
asp:Label
>
</
td
>
<
td
>
<
telerik:RadDatePicker
ID
=
"calFromDate"
runat
=
"server"
Width
=
"100px"
Font-Names
=
"Verdana"
Calendar-ShowRowHeaders
=
"false"
>
<
Calendar
runat
=
"server"
>
<
SpecialDays
>
<
telerik:RadCalendarDay
Repeatable
=
"today"
ItemStyle-BorderColor
=
"blue"
></
telerik:RadCalendarDay
>
</
SpecialDays
>
</
Calendar
>
</
telerik:RadDatePicker
>
<%--<
ew:CalendarPopup
ID
=
"calFromDate"
Width
=
"65px"
runat
=
"server"
Font-Names
=
"Verdana"
DisableTextBoxEntry
=
"false"
Nullable
=
"true"
ShowClearDate
=
"true"
>
</
ew:CalendarPopup
>--%>
</
td
>
<
td
>
<
asp:Label
ID
=
"Label7"
Text
=
"Thru"
runat
=
"server"
Font-Names
=
"Verdana"
></
asp:Label
>
</
td
>
<
td
>
<
telerik:RadDatePicker
ID
=
"calThruDate"
runat
=
"server"
Width
=
"100px"
Font-Names
=
"Verdana"
Calendar-ShowRowHeaders
=
"false"
>
<
Calendar
ID
=
"Calendar1"
runat
=
"server"
>
<
SpecialDays
>
<
telerik:RadCalendarDay
Repeatable
=
"today"
ItemStyle-BorderColor
=
"blue"
></
telerik:RadCalendarDay
>
</
SpecialDays
>
</
Calendar
>
</
telerik:RadDatePicker
>
<%--<
ew:CalendarPopup
ID
=
"calThruDate"
Width
=
"65px"
runat
=
"server"
Font-Names
=
"Verdana"
DisableTextBoxEntry
=
"false"
Nullable
=
"true"
ShowClearDate
=
"true"
>
</
ew:CalendarPopup
>--%>
</
td
>
<
td
>
<
asp:Label
ID
=
"Label11"
Text
=
"* Required; Date range is limited to "
runat
=
"server"
Font-Names
=
"Verdana"
></
asp:Label
>
<%=maxDays %> <
asp:Label
Text
=
" calendar days"
runat
=
"server"
Font-Names
=
"Verdana"
></
asp:Label
>
<
img
src
=
"../App_Themes/images/information.gif"
onmouseover
=
"displayDateInfoDiv(true);"
onmouseout
=
"displayDateInfoDiv(false);"
/>
<
div
id
=
"divDates"
runat
=
"server"
style="display:none; border:solid 1px gray; background-color:White; font-family:Verdana; font-size:x-small;
width:150px; position:absolute; z-index:1000; padding:5px 5px 5px 5px;">
The date range can be any <%=maxDays %> day range in any year, not just the last <%=maxDays %> days. If no date range is selected, the last <%=maxDays %> calendar days will be set as the range.
</
div
>
</
td
>
</
tr
>
</
table
>
<%-- <
hr
id
=
"HR4"
style
=
"width: 950px"
color
=
"#ff9933"
/>
--%>
<
ajax:UpdatePanel
ID
=
"UpdatePanel1"
runat
=
"server"
>
<
ContentTemplate
>
<
table
>
<
tr
>
<
td
>
<
asp:ImageButton
ID
=
"btnSearch"
runat
=
"server"
OnClick
=
"btnSearch_Click"
AlternateText
=
"Search"
ImageUrl
=
"~/App_Themes/Images/Search.jpg"
/>
<
input
type
=
"button"
onclick
=
"ibClear_Click();"
style
=
"background-image:url('../App_Themes/images/clear.jpg'); height:31px; width:124px; border-style:none;"
/>
</
td
>
<
td
>
<
asp:Label
ID
=
"lblSearchWarning"
runat
=
"server"
Font-Names
=
"Verdana"
Font-Size
=
"X-Small"
ForeColor
=
"Red"
style
=
"position: relative;"
></
asp:Label
>
</
td
>
</
tr
>
</
table
>
</
ContentTemplate
>
</
ajax:UpdatePanel
>
<
hr
id
=
"HR1"
style
=
"width: 950px"
class
=
"colorScheme"
/>
<
br
/>
<
div
id
=
"PDiv2"
align
=
"left"
style
=
"left: 0px; position: relative; width: 950px; top: 0px; font-size:x-small;"
>
<%-- <
asp:Panel
ID
=
"pnlRespond"
runat
=
"server"
Width
=
"950px"
HorizontalAlign
=
"left"
>
--%>
<
ajax:UpdateProgress
ID
=
"UpdateProgress1"
runat
=
"server"
>
<
ProgressTemplate
>
<
div
style
=
"position:absolute; top:80px; left:450px"
>
<
img
src
=
"../App_Themes/Images/ProgressIndicator.GIF"
/>
</
div
>
<
div
style
=
"position:absolute; top:190px; left:440px; font-size:large; font-weight:bold;"
>
Loading...
</
div
>
</
ProgressTemplate
>
</
ajax:UpdateProgress
>
<
ajax:UpdatePanel
ID
=
"p1"
runat
=
"server"
>
<
ContentTemplate
>
<%-- <
table
>
<
tr
>
<
td
>
<
asp:ImageButton
ID
=
"btnViewTicket"
runat
=
"server"
OnClick
=
"btnViewTicket_Click"
AlternateText
=
"View Ticket"
ImageUrl
=
"~/App_Themes/Images/ViewTicket.jpg"
/>
</
td
>
<
td
>
<
asp:ImageButton
ID
=
"btnUtility"
runat
=
"server"
OnClick
=
"btnUtility_Click"
AlternateText
=
"Utility Response"
ImageUrl
=
"~/App_Themes/Images/UtilityResponse.jpg"
/>
</
td
>
<
td
>
<
asp:Label
ID
=
"Label14"
Text
=
"Highlight ticket you wish to view"
runat
=
"server"
Font-Names
=
"Verdana"
style
=
"position: relative;"
></
asp:Label
>
</
td
>
</
tr
>
</
table
>
--%>
<
div
>
<
div
style
=
"float:left;"
>
<
asp:Label
ID
=
"Label14"
Text
=
"Click on a ticket number to view that ticket’s positive responses and original ticket information."
runat
=
"server"
Font-Names
=
"Verdana"
style
=
"position: relative;"
></
asp:Label
>
</
div
>
<
telerik:RadAjaxPanel
ID
=
"RadAjaxPanel1"
runat
=
"server"
ClientEvents-OnRequestStart
=
"pnlRequestStarted"
>
<
div
style
=
"padding-bottom:5px; float:right; vertical-align:top;"
>
<
div
style
=
"float:left;"
>
<
label
id
=
"Label2"
runat
=
"server"
style
=
"font-family:Verdana; font-size:x-small; vertical-align:middle;"
>Print List:</
label
>
<
asp:ImageButton
ImageAlign
=
"right"
ID
=
"ibPrint"
runat
=
"server"
ImageUrl
=
"~/App_Themes/images/Print_Icon.jpg"
ToolTip
=
"Print Grid"
OnClientClick
=
"PrintRadGrid();"
/>
</
div
>
<
div
style
=
"float:right;"
>
<
label
runat
=
"server"
style
=
"font-family:Verdana; font-size:x-small; vertical-align:middle;"
>Export to Excel:</
label
>
<
asp:ImageButton
ImageAlign
=
"right"
ID
=
"ibExport"
runat
=
"server"
ImageUrl
=
"~/App_Themes/images/excel_export.gif"
ToolTip
=
"Export to Excel"
OnClick
=
"ibExport_Click"
/>
</
div
>
</
div
>
</
telerik:RadAjaxPanel
>
</
div
>
<
div
style
=
"clear:both; float:none;"
></
div
>
<
div
style
=
"border: solid thin black;"
>
<
telerik:RadGrid
ID
=
"grdTicket"
runat
=
"server"
AutoGenerateColumns
=
"false"
Width
=
"946px"
Font-Names
=
"Verdana"
Font-Size
=
"x-small"
EnableViewState
=
"true"
AllowSorting
=
"true"
AllowPaging
=
"true"
AllowMultiRowSelection
=
"false"
OnNeedDataSource
=
"grdTicket_NeedDataSource"
OnPageIndexChanged
=
"grdTicket_PageIndexChanged"
>
<
MasterTableView
Width
=
"100%"
NoDetailRecordsText
=
"No Records To Display"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"origdtdate"
HeaderText
=
"Call In Date"
ReadOnly
=
"true"
SortExpression
=
"origdtdate"
></
telerik:GridBoundColumn
>
<
telerik:GridHyperLinkColumn
DataTextField
=
"ticketnum"
HeaderText
=
"Ticket#"
SortExpression
=
"ticketnum"
DataNavigateUrlFields
=
"ticketnum"
DataNavigateUrlFormatString
=
"SearchViewTicket.aspx?ticketnum={0}"
></
telerik:GridHyperLinkColumn
>
<
telerik:GridBoundColumn
DataField
=
"address"
HeaderText
=
"Address"
ReadOnly
=
"true"
SortExpression
=
"address"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"street"
HeaderText
=
"Street"
ReadOnly
=
"true"
SortExpression
=
"street"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"city"
HeaderText
=
"City"
ReadOnly
=
"true"
SortExpression
=
"city"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"county"
HeaderText
=
"County"
ReadOnly
=
"true"
SortExpression
=
"county"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"company"
HeaderText
=
"Contractor"
ReadOnly
=
"true"
SortExpression
=
"company"
></
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
<
PagerStyle
Mode
=
"NextPrevNumericAndAdvanced"
ShowPagerText
=
"true"
/>
</
telerik:RadGrid
>
<
div
id
=
"divGrid"
style
=
"display:none;"
>
<
telerik:RadGrid
ID
=
"grdDuplicate"
runat
=
"server"
AutoGenerateColumns
=
"false"
Width
=
"946px"
Font-Names
=
"Verdana"
Font-Size
=
"x-small"
>
<
MasterTableView
Width
=
"100%"
NoDetailRecordsText
=
"No Records To Display"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"origdtdate"
HeaderText
=
"Call In Date"
ReadOnly
=
"true"
SortExpression
=
"origdtdate"
></
telerik:GridBoundColumn
>
<
telerik:GridHyperLinkColumn
DataTextField
=
"ticketnum"
HeaderText
=
"Ticket#"
SortExpression
=
"ticketnum"
DataNavigateUrlFields
=
"ticketnum"
DataNavigateUrlFormatString
=
"SearchViewTicket.aspx?ticketnum={0}"
></
telerik:GridHyperLinkColumn
>
<
telerik:GridBoundColumn
DataField
=
"address"
HeaderText
=
"Address"
ReadOnly
=
"true"
SortExpression
=
"address"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"street"
HeaderText
=
"Street"
ReadOnly
=
"true"
SortExpression
=
"street"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"city"
HeaderText
=
"City"
ReadOnly
=
"true"
SortExpression
=
"city"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"county"
HeaderText
=
"County"
ReadOnly
=
"true"
SortExpression
=
"county"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"company"
HeaderText
=
"Contractor"
ReadOnly
=
"true"
SortExpression
=
"company"
></
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
</
div
>
</
div
>
<
div
>
<
asp:Label
ID
=
"lblGridWarning"
runat
=
"server"
Font-Names
=
"Verdana"
Font-Size
=
"X-Small"
ForeColor
=
"Red"
style
=
"position: relative; vertical-align: middle"
></
asp:Label
>
</
div
>
</
ContentTemplate
>
</
ajax:UpdatePanel
>
<%-- </
asp:Panel
>
--%>
</
div
>
</
asp:Panel
>
</
div
>
</
center
>
</
div
>
</
asp:Content
>
using
System;
using
System.Data;
using
System.Configuration;
using
System.Collections;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
using
System.Data.SqlClient;
using
System.Drawing;
using
System.Web.Configuration;
using
KorTerra.Log;
using
Telerik.Web.UI;
public
partial
class
Search : System.Web.UI.Page, System.Web.UI.ICallbackEventHandler
{
private
Int32 m_iRowIdx;
public
string
maxDays = ConfigurationManager.AppSettings.Get(
"maxSearchDays"
);
public
struct
respondCriteria
{
public
string
member;
public
string
membercode;
public
string
fromDate;
public
string
thruDate;
};
public
string
fromDate;
public
string
thruDate;
public
Log log;
public
bool
traceSQL;
public
string
errorLogFile;
int
maxTicketNumberLength = 15;
bool
ticketNumberMustBeMaxLen =
false
;
protected
void
Page_Load(
object
sender, EventArgs e)
{
string
url = ConfigurationManager.AppSettings.Get(
"searchVideoUrl"
);
if
(url !=
null
&& url !=
""
)
hiddenUrl.Value = url;
else
ibVideo.Visible =
false
;
traceSQL = (
string
)Session[
"traceSQL"
] ==
"true"
?
true
:
false
;
errorLogFile = (
string
)Session[
"errorLogFile"
];
try
{
maxTicketNumberLength = (
int
)Session[
"MaxTicketNumberLength"
];
}
catch
{
try
{
maxTicketNumberLength = Convert.ToInt16(ConfigurationManager.AppSettings.Get(
"MaxTicketNumberLength"
));
Session[
"MaxTicketNumberLength"
] = maxTicketNumberLength;
}
catch
{
maxTicketNumberLength = 15;
}
}
txtTicketnum.MaxLength = maxTicketNumberLength;
try
{
ticketNumberMustBeMaxLen = (
string
)Session[
"TicketNumberMustBeMaxLen"
] ==
"true"
?
true
:
false
;
}
catch
{
try
{
string
strTicketNumberMustBeMaxLen = ConfigurationManager.AppSettings.Get(
"TicketNumberMustBeMaxLen"
);
if
(strTicketNumberMustBeMaxLen !=
null
&& strTicketNumberMustBeMaxLen.ToUpper() ==
"YES"
)
{
ticketNumberMustBeMaxLen =
true
;
Session[
"TicketNumberMustBeMaxLen"
] =
"true"
;
}
else
{
ticketNumberMustBeMaxLen =
false
;
Session[
"TicketNumberMustBeMaxLen"
] =
"false"
;
}
}
catch
{
ticketNumberMustBeMaxLen =
false
;
}
}
log =
new
Log();
log.setLogFile(errorLogFile);
lblSearchWarning.Text =
""
;
lblGridWarning.Text =
""
;
// MaintainScrollPositionOnPostBack = true;
SetupAlways();
txtTicketnum.Attributes.Add(
"onchange"
,
"javascript:this.value = this.value.toUpperCase();"
);
txtAddress.Attributes.Add(
"onchange"
,
"javascript:this.value = this.value.toUpperCase();"
);
txtStreet.Attributes.Add(
"onchange"
,
"javascript:this.value = this.value.toUpperCase();"
);
txtCounty.Attributes.Add(
"onchange"
,
"javascript:this.value = this.value.toUpperCase();"
);
txtCompany.Attributes.Add(
"onchange"
,
"javascript:this.value = this.value.toUpperCase();"
);
txtTicketnum.Focus();
Session[
"grdTicketRow"
] = -1;
if
(!IsPostBack)
{
populateMembercodeDD();
if
(Session[
"grdTicketDataView"
] !=
null
)
{
grdTicket.AllowPaging =
true
;
grdTicket.DataSource = (DataView)Session[
"grdTicketDataView"
];
txtAddress.Text = Session[
"txtAddress"
].ToString();
txtStreet.Text = Session[
"txtStreet"
].ToString();
txtCounty.Text = Session[
"txtCounty"
].ToString();
txtCompany.Text = Session[
"txtCompany"
].ToString();
calFromDate.SelectedDate = DateTime.Parse(Session[
"calFromDate"
].ToString());
calThruDate.SelectedDate = DateTime.Parse(Session[
"calThruDate"
].ToString());
if
(Session[
"TicketGridPage"
] !=
null
&& Session[
"TicketGridPage"
].ToString() !=
""
)
{
grdTicket.CurrentPageIndex = Convert.ToInt32(Session[
"TicketGridPage"
]);
grdTicket.Rebind();
}
}
else
{
grdTicket.DataSource =
string
.Empty;
//if (Session["txtTicketnum"] != null)
// txtTicketnum.Text = Session["txtTicketnum"].ToString();
if
(Session[
"txtAddress"
] !=
null
)
txtAddress.Text = Session[
"txtAddress"
].ToString();
if
(Session[
"txtStreet"
] !=
null
)
txtStreet.Text = Session[
"txtStreet"
].ToString();
if
(Session[
"txtCounty"
] !=
null
)
txtCounty.Text = Session[
"txtCounty"
].ToString();
if
(Session[
"txtCompany"
] !=
null
)
txtCompany.Text = Session[
"txtCompany"
].ToString();
if
(Session[
"calFromDate"
] !=
null
)
calFromDate.SelectedDate = DateTime.Parse(Session[
"calFromDate"
].ToString());
//else
// calFromDate.SelectedDate = DateTime.ParseExact(DateTime.Today.Date.ToShortDateString(), "M/d/yyyy", null);
if
(Session[
"calThruDate"
] !=
null
)
calThruDate.SelectedDate = DateTime.Parse(Session[
"calThruDate"
].ToString());
}
}
}
protected
void
ibExport_Click(
object
sender, EventArgs e)
{
grdTicket.MasterTableView.GridLines = GridLines.Both;
grdTicket.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML;
grdTicket.ExportSettings.IgnorePaging =
true
;
grdTicket.ExportSettings.OpenInNewWindow =
true
;
grdTicket.ExportSettings.ExportOnlyData =
true
;
grdTicket.MasterTableView.ExportToExcel();
}
protected
void
OnTicketRowCreated(
object
sender, GridViewRowEventArgs e)
{
try
{
if
(e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add(
"onclick"
,
"onTicketGridViewRowSelected('"
+ m_iRowIdx.ToString() +
"')"
);
}
m_iRowIdx++;
}
catch
(Exception ex)
{
log.logErrorMessage(
"Search::OnTicketRowCreated - "
+ ex.Message.ToString());
}
}
private
void
SetupAlways()
{
//setup callbacks:
string
cbReference =
Page.ClientScript.GetCallbackEventReference(
this
,
"arg"
,
"ReceiveCallback"
,
"context"
);
string
callbackScript =
"function CallServer(arg, context)"
+
"{ "
+ cbReference +
"} ;"
;
Page.ClientScript.RegisterClientScriptBlock(
this
.GetType(),
"CallServer"
,
callbackScript,
true
);
}
#region ICallbackEventHandler Members
public
void
RaiseCallbackEvent(String eventArgument)
{
string
row = eventArgument;
Session[
"grdTicketRow"
] = Convert.ToInt32(row);
}
public
string
GetCallbackResult()
{
return
Session[
"grdTicketRow"
].ToString();
}
#endregion
protected
void
btnSearch_Click(
object
sender, EventArgs e)
{
if
(ConfigurationManager.AppSettings.Get(
"practiceMode"
).ToUpper() ==
"TRUE"
)
lblSearchWarning.Text =
"For practice purposes, all searches will bring up tickets from 10/15/2010, no matter which criteria is entered. The site will be live and functional on January 1, 2011."
;
grdTicket.DataSource =
null
;
grdTicket.Rebind();
grdDuplicate.Rebind();
}
protected
void
grdTicket_NeedDataSource(
object
sender, GridNeedDataSourceEventArgs e)
{
DataTable dt =
new
DataTable();
if
(IsPostBack)
{
dt = populateGrid();
grdTicket.DataSource = dt;
grdDuplicate.DataSource = dt;
}
}
protected
void
grdTicket_PageIndexChanged(
object
source, GridPageChangedEventArgs e)
{
Session[
"TicketGridPage"
] = e.NewPageIndex;
}
private
DataTable populateGrid()
{
try
{
DataTable dt =
new
DataTable(
"ticket"
);
Session.Remove(
"grdTicketDataView"
);
Session.Remove(
"Count"
);
Session.Remove(
"calFromDate"
);
Session.Remove(
"calThruDate"
);
//grdTicket.DataSource = null;
//grdTicket.DataBind();
if
(calFromDate.SelectedDate !=
null
||
calThruDate.SelectedDate !=
null
)
{
if
(calFromDate.SelectedDate ==
null
)
{
lblSearchWarning.Text =
"Missing From Date."
;
return
null
;
}
if
(calThruDate.SelectedDate ==
null
)
{
lblSearchWarning.Text =
"Missing Thru Date."
;
return
null
;
}
DateTime fromPlusRange = DateTime.Parse(calFromDate.SelectedDate.ToString()).AddDays(Convert.ToDouble(maxDays));
// if (calFromDate.SelectedDate.Date.CompareTo(calThruDate.SelectedDate.Date.AddDays(-15.0)) > 1)
if
(fromPlusRange < calThruDate.SelectedDate)
{
lblSearchWarning.Text =
"Must be less than "
+ maxDays +
" day date range"
;
return
null
;
}
}
if
(calFromDate.SelectedDate ==
null
)
{
if
(fromDate !=
null
)
{
calFromDate.SelectedDate = DateTime.Parse(fromDate);
}
else
{
calFromDate.SelectedDate = DateTime.Today.Date.AddDays(Convert.ToDouble(maxDays) * -1);
// DateTime.ParseExact(theFromDate.ToShortDateString(), "M/d/yyyy", null);
}
}
if
(calThruDate.SelectedDate ==
null
)
{
if
(thruDate !=
null
)
{
calThruDate.SelectedDate = DateTime.Parse(thruDate);
}
else
{
calThruDate.SelectedDate = DateTime.Parse(DateTime.Today.Date.ToString());
}
}
if
(Session.Count > 0)
{
m_iRowIdx = 0;
int
iCount = 0;
string
connString = ConfigurationManager.AppSettings.Get(
"DBConnectionString"
);
SqlConnection con =
new
SqlConnection(connString);
string
selectString =
"SELECT distinct ticketnum, address, street, city, county, company, origdtdate "
;
selectString +=
"FROM ticket WHERE "
;
if
(ConfigurationManager.AppSettings.Get(
"practiceMode"
).ToUpper() ==
"TRUE"
)
{
if
(calFromDate.SelectedDate !=
null
)
{
selectString +=
"origdtdate >= '10/15/2010'"
;
selectString +=
" AND "
;
}
if
(calThruDate.SelectedDate !=
null
)
{
selectString +=
"origdtdate <= '10/15/2010' "
;
}
}
else
{
if
(txtTicketnum.Text.Trim().Length > 0)
{
selectString +=
"ticketnum = '"
+ txtTicketnum.Text.Trim() +
"' "
;
}
else
{
if
(txtAddress.Text.Trim().Length > 0)
{
selectString +=
"address like '%"
;
selectString += txtAddress.Text.Trim();
selectString +=
"%' AND "
;
// groupSearch = 1;
}
if
(txtStreet.Text.Trim().Length > 0)
{
selectString +=
"street like '%"
;
selectString += txtStreet.Text.Trim();
selectString +=
"%' AND "
;
// groupSearch = 1;
}
if
(txtCity.Text.Trim().Length > 0)
{
selectString +=
"city like '%"
;
selectString += txtCity.Text.Trim();
selectString +=
"%' AND "
;
// groupSearch = 1;
}
if
(txtCounty.Text.Trim().Length > 0)
{
selectString +=
"county like '%"
;
selectString += txtCounty.Text.Trim();
selectString +=
"%' AND "
;
// groupSearch = 1;
}
// if (groupSearch == 0)
// {
if
(txtCompany.Text.Trim().Length > 0)
{
selectString +=
"company like '%"
;
selectString += txtCompany.Text.Trim();
selectString +=
"%' AND "
;
}
if
(calFromDate.SelectedDate !=
null
)
{
selectString +=
"origdtdate >= '"
;
selectString += DateTime.Parse(calFromDate.SelectedDate.ToString());
selectString +=
"' AND "
;
}
else
{
lblGridWarning.Text =
"You must enter a date range if you do not give a ticket number."
;
return
null
;
}
if
(calThruDate.SelectedDate !=
null
)
{
selectString +=
"origdtdate <= '"
;
selectString += DateTime.Parse(calThruDate.SelectedDate.ToString());
selectString +=
"' AND "
;
}
else
{
lblGridWarning.Text =
"You must enter a date range if you do not give a ticket number."
;
return
null
;
}
if
(ddMemberCode.Text.Trim() !=
""
)
{
selectString +=
"ticketnum IN (SELECT ticketnum FROM responserequest "
;
selectString +=
"WHERE membercode = '"
+ ddMemberCode.Text.Trim() +
"') AND "
;
}
// }
selectString +=
"1 = 1 "
;
}
}
selectString +=
"Order by ticketnum"
;
if
(traceSQL)
log.logMessage(selectString);
SqlCommand cmd =
new
SqlCommand(selectString, con);
dt.Columns.Add(
new
DataColumn(
"origdtdate"
));
dt.Columns.Add(
new
DataColumn(
"ticketnum"
));
dt.Columns.Add(
new
DataColumn(
"address"
));
dt.Columns.Add(
new
DataColumn(
"street"
));
dt.Columns.Add(
new
DataColumn(
"city"
));
dt.Columns.Add(
new
DataColumn(
"county"
));
dt.Columns.Add(
new
DataColumn(
"company"
));
con.Open();
SqlDataReader dtr;
try
{
dtr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
}
catch
(Exception ex)
{
log.logErrorMessage(
"Search::btnSearch_Click - "
+ ex.Message.ToString() +
"\n"
+ cmd.CommandText);
return
null
;
}
string
singleTicketNum =
""
;
string
origdtdate =
""
;
string
ticketnum =
""
;
string
address =
""
;
string
street =
""
;
string
city =
""
;
string
county =
""
;
string
company =
""
;
if
(dtr.HasRows)
{
while
(dtr.Read())
{
origdtdate =
""
;
ticketnum =
""
;
address =
""
;
street =
""
;
city =
""
;
county =
""
;
company =
""
;
if
(dtr.GetValue(0) != DBNull.Value)
ticketnum = dtr.GetString(0).Trim();
if
(dtr.GetValue(1) != DBNull.Value)
address = dtr.GetString(1).Trim();
if
(dtr.GetValue(2) != DBNull.Value)
street = dtr.GetString(2).Trim();
if
(dtr.GetValue(3) != DBNull.Value)
city = dtr.GetString(3).Trim();
if
(dtr.GetValue(4) != DBNull.Value)
county = dtr.GetString(4).Trim();
if
(dtr.GetValue(5) != DBNull.Value)
company = dtr.GetString(5).Trim();
if
(dtr.GetValue(6) != DBNull.Value)
origdtdate = dtr.GetDateTime(6).ToShortDateString();
dt.Rows.Add(
new
object
[] { origdtdate, ticketnum, address, street, city, county, company });
iCount++;
if
(iCount == 1)
singleTicketNum = ticketnum;
}
dtr.Close();
}
else
{
lblSearchWarning.Text =
"Please refine your search criteria above."
;
}
con.Close();
//grdTicket.DataSource = dt.DefaultView;
//grdTicket.Rebind();
Session[
"grdTicketDataView"
] = dt.DefaultView;
// Session["txtTicketnum"] = txtTicketnum.Text.Trim();
Session[
"txtAddress"
] = txtAddress.Text.Trim();
Session[
"txtStreet"
] = txtStreet.Text.Trim();
Session[
"txtCounty"
] = txtCounty.Text.Trim();
Session[
"txtCompany"
] = txtCompany.Text.Trim();
Session[
"calFromDate"
] = DateTime.Parse(calFromDate.SelectedDate.ToString());
Session[
"calThruDate"
] = DateTime.Parse(calThruDate.SelectedDate.ToString());
//if (iCount == 1)
//{
// // ticketnum = grdTicket.Rows[0].Cells[1].Text;
// string redirect = "SearchResults.aspx?ticketnum=" + ticketnum;
// Response.Redirect(redirect);
//}
}
else
{
Response.Redirect(
"~/Default.aspx"
);
}
return
dt;
}
catch
(Exception ex)
{
log.logErrorMessage(
"Search::btnSearch_Click - "
+ ex.Message.ToString());
return
null
;
}
}
protected
void
populateMembercodeDD()
{
try
{
string
connString = ConfigurationManager.AppSettings.Get(
"DBConnectionString"
);
SqlConnection con =
new
SqlConnection(connString);
string
selectString =
"SELECT distinct membercode "
;
selectString +=
"FROM responserequest "
;
selectString +=
"ORDER BY membercode"
;
if
(traceSQL)
log.logMessage(selectString);
SqlCommand cmd =
new
SqlCommand(selectString, con);
con.Open();
SqlDataReader dtr;
try
{
dtr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
}
catch
(Exception ex)
{
log.logErrorMessage(
"Respond::populateMembercodeDD - "
+ ex.Message.ToString() +
"\n"
+ cmd.CommandText);
return
;
}
ddMemberCode.Items.Clear();
ddMemberCode.Items.Add(
""
);
if
(dtr.HasRows)
{
while
(dtr.Read())
{
ddMemberCode.Items.Add(dtr.GetString(0).Trim());
}
dtr.Close();
}
con.Close();
}
catch
(Exception ex)
{
log.logErrorMessage(
"Respond::populateMembercodeDD - "
+ ex.Message.ToString());
}
}
}
0
Hello Brian,
I have examined your code and the only problem I notices it that you have a RadAjaxPanel nested in an asp:UpdatePanel.
I recommend that you either remove one of them, or replace it with an asp:Panel.
If the issue persists, please send us a small working project, demonstrating your full setup and showing the unwanted behavior.
We will debug it locally and get back to you.
Thank you in advance for the cooperation.
Greetings,
Mira
the Telerik team
I have examined your code and the only problem I notices it that you have a RadAjaxPanel nested in an asp:UpdatePanel.
I recommend that you either remove one of them, or replace it with an asp:Panel.
If the issue persists, please send us a small working project, demonstrating your full setup and showing the unwanted behavior.
We will debug it locally and get back to you.
Thank you in advance for the cooperation.
Greetings,
Mira
the Telerik team