I have a rad grid where I want to click 'Page 8' and only pull back records 81-90. My pagesize is set to 10. I have tried the link below and added all the code to the onneeddatasource, but I am not sure how to get the pageindex that I just clicked. CurrentPageIndex seems to be the index the page is currently on. I need the page I clicked. Also, how does rad grid look at when you hit the 'last page' or 'first page' or 'next page' or 'previous page' or 'next pages..'
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/custompaging/defaultcs.aspx
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/custompaging/defaultcs.aspx
9 Answers, 1 is accepted
0
Hello,
The CurrentPageIndex when used in the NeedDataSource event returns the newly selected PageIndex and as you could see in the demo application we are using it to calculate the offset of the records:
and the upper bound is calculated this way:
Next you should define a method which will take these numbers and return only the items between these bounds.
About your other question, when you press LastPage button, RadGrid takes the total amount of items in the datasource and divides it to the PageSize. This will return the Page count. Once you have the page count you could subtract 1 by it and multiply it by the PageSize. this will return the lower bound of the range. The upper bound is the total amount of items. The same rule is used for next and previous page.
Greetings,
Andrey
the Telerik team
The CurrentPageIndex when used in the NeedDataSource event returns the newly selected PageIndex and as you could see in the demo application we are using it to calculate the offset of the records:
int
startRowIndex = (ShouldApplySortFilterOrGroup()) ?
0 : RadGrid1.CurrentPageIndex * RadGrid1.PageSize;
and the upper bound is calculated this way:
int
maximumRows = (ShouldApplySortFilterOrGroup()) ?
MyBusinessObjectCollection1.SelectCount() : RadGrid1.PageSize;
Next you should define a method which will take these numbers and return only the items between these bounds.
About your other question, when you press LastPage button, RadGrid takes the total amount of items in the datasource and divides it to the PageSize. This will return the Page count. Once you have the page count you could subtract 1 by it and multiply it by the PageSize. this will return the lower bound of the range. The upper bound is the total amount of items. The same rule is used for next and previous page.
Greetings,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

tvb2727
Top achievements
Rank 1
answered on 31 Jan 2013, 05:46 PM
I added that code in my NeedDataSource and it's still not showing right. Say I click on page 3, it will show the last current page for my start index. Then will I click say page 4, page 3 will now be the starting index (of course * page size). Not sure what I'm missing. Here is my C#:
HTML:
Then In my PostBack I have:
protected
void
rgTestCustom_NeedDataSource(
object
source, GridNeedDataSourceEventArgs e)
{
int
startRowIndex = (ShouldApplySortFilterOrGroup()) ?
0 : rgTestCustom.CurrentPageIndex * rgTestCustom.PageSize;
int
maximumRows = (ShouldApplySortFilterOrGroup()) ?
2000(Total records in my grid)
: rgTestCustom.PageSize;
rgTestCustom.MasterTableView.AllowCustomPaging = !ShouldApplySortFilterOrGroup();
rgTestCustom.DataSource = MyDataSource;
int
virtualcount = rgTestCustom.MasterTableView.VirtualItemCount;
}
HTML:
<
telerik:RadGrid
ShowGroupPanel
=
"true"
AutoGenerateColumns
=
"true"
ID
=
"rgTestCustom"
PageSize
=
"10"
OnNeedDataSource
=
"rgTestCustom_NeedDataSource"
runat
=
"server"
GridLines
=
"Both"
AllowCustomPaging
=
"true"
AllowPaging
=
"true"
VirtualItemCount
=
"10"
Visible
=
"true"
style
=
"margin-bottom: 0px"
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
></
PagerStyle
>
<
MasterTableView
ShowGroupFooter
=
"false"
AllowMultiColumnSorting
=
"false"
AllowCustomPaging
=
"true"
VirtualItemCount
=
"10"
PageSize
=
"10"
AllowPaging
=
"true"
>
<
NoRecordsTemplate
>
<
div
style
=
"text-align: center;"
>
<
asp:Label
ForeColor
=
"Black"
runat
=
"server"
ID
=
"lblNoRecords"
>No Records Found</
asp:Label
>
</
div
>
</
NoRecordsTemplate
>
</
MasterTableView
>
<
ClientSettings
AllowDragToGroup
=
"false"
>
</
ClientSettings
>
<
GroupingSettings
ShowUnGroupButton
=
"false"
></
GroupingSettings
>
</
telerik:RadGrid
>
Then In my PostBack I have:
rgTestCustom.Rebind();
0
Hi,
Are you saying that when page 4 is selected the PageIndex returns 3 instead of 4? As you most probably know most of the indexes are zero-based. So, it is normal to get 3 as an index when you are at page four.
If the case is different please elaborate a bit more on the scenario.
Kind regards,
Andrey
the Telerik team
Are you saying that when page 4 is selected the PageIndex returns 3 instead of 4? As you most probably know most of the indexes are zero-based. So, it is normal to get 3 as an index when you are at page four.
If the case is different please elaborate a bit more on the scenario.
Kind regards,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

tvb2727
Top achievements
Rank 1
answered on 05 Feb 2013, 12:57 PM
Yea I know they're zero based. But like if I was on page 4 and I click page 6, it's showing the currentpageindex as 3 instead of 5, so my start index return will be 30 instead of 50. My pagesize is set to 10. Does that make sense?
0
Hi,
It should be working as expected. I created a sample project to verify this and it is working as expected on my side.
Give it a try and check if it differs from yours.
Greetings,
Andrey
the Telerik team
It should be working as expected. I created a sample project to verify this and it is working as expected on my side.
Give it a try and check if it differs from yours.
Greetings,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

aman bindaal
Top achievements
Rank 1
answered on 21 Aug 2013, 06:12 PM
Hi I am trying to implement cusomt paging too, I am binding radgrid with a datatable with 12 rows and has page size of 3 , My issue is whenever I set custom paging true paging stops working, automatic paging is working fine, but custom is not working at all, I am working first time with Radgrid, I would really appreciate if you could help me woth some sample code of Cusomt Paging and Custom Sorting with databinding using datatable\dataset.
0
Hi,
Please check this online demo application and should not have problems achieving your goal.
Regards,
Andrey
Telerik
Please check this online demo application and should not have problems achieving your goal.
Regards,
Andrey
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0

Phillip
Top achievements
Rank 1
answered on 02 Apr 2015, 08:09 AM
Hi Telerik team,
I am having issue with the loading of 1000s of record in the Telerik Grid version 2015.1.225.35.I have implemented the logic mentioned in the demo for the custom paging. It is not working as expected.The issue i am facing here is as folows
1. It is not loading the data in different pages.Instead it loads the data in the same first page but the index keeps changing.
2. Once Ioad 1000 record by setting the page size in the drop down as 1000 it is does not to change to other page size.
3. We have many pages with similar requirement . Hence provide your reply as early as possible.
Note: I have here with attched the .ascx and .cs file for the page that i have tried. We are using this for the Sharepoint 2010 application.
Thanks
Bhuvaneswari.H
I am having issue with the loading of 1000s of record in the Telerik Grid version 2015.1.225.35.I have implemented the logic mentioned in the demo for the custom paging. It is not working as expected.The issue i am facing here is as folows
1. It is not loading the data in different pages.Instead it loads the data in the same first page but the index keeps changing.
2. Once Ioad 1000 record by setting the page size in the drop down as 1000 it is does not to change to other page size.
3. We have many pages with similar requirement . Hence provide your reply as early as possible.
Note: I have here with attched the .ascx and .cs file for the page that i have tried. We are using this for the Sharepoint 2010 application.
Thanks
Bhuvaneswari.H
0

Phillip
Top achievements
Rank 1
answered on 02 Apr 2015, 08:15 AM
Hi Team,
I am not able to attach the cs and ascx file. Hence I will attach the code in the text from.
ascx file.
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages"
Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AuthoriseCashMonitoringExceptionsUserControl.ascx.cs"
Inherits="BNYM.EDS.AIFMD.View.AuthoriseCashMonitoringExceptions.AuthoriseCashMonitoringExceptionsUserControl" %>
<%@ Register Assembly="Telerik.Web.UI, Version=2015.1.225.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<SharePoint:CssRegistration ID="CssRegistration1" Name="<% $SPUrl:~SiteCollection/Style Library/AIFMDResources/Styles/AIFMD.Content.v1.css%>"
After="corev4.css" runat="server" />
<SharePoint:CssRegistration ID="CssRegistration2" Name="<% $SPUrl:~SiteCollection/Style Library/AIFMDResources/Styles/CreateThirdPartyStatment.css%>"
After="corev4.css" runat="server" />
<style type="text/css">
.rgDataDiv
{
height: 400px !important;
}
.ms-input
{
width: 75px;
}
.statusmsg
{
font-family: Tahoma !important;
font-size: 10pt !important;
font-weight: bold;
float: left;
color: Green;
}
#progressBackgroundFilter
{
position: fixed;
top: 0px;
bottom: 0px;
left: 0px;
right: 0px;
overflow: hidden;
padding: 0;
margin: 0;
background-color: #000;
filter: alpha(opacity=50);
opacity: 0.5;
z-index: 1000;
}
#processMessage
{
position: fixed;
top: 43%;
left: 43%;
z-index: 1001;
border: none;
}
</style>
<script type="text/jscript">
// function OpenDialog(result) {
// var options = {
// url: '<asp:Literal runat="server" Text="<%$SPUrl:~Site/Pages/AuthoriseCashMonitoringExceptionPopUp.aspx?CashTransactionID=%>" />' + result,
// title: 'Authorize : Cash Monitoring Exception',
// allowMaximize: false,
// showClose: true,
// Height: 1500,
// Width: 1500,
// dialogReturnValueCallback: RefreshResult
// };
// SP.UI.ModalDialog.showModalDialog(options);
// } var selected = [];
//This function is used to validate the checkbox selection, check if record exists and to display a promp message to the user before deleting the designee
function ValidateSelect(sender, args) {
args.set_cancel(false);
var grid = $find("<%=grdAuthorizeException.ClientID %>");
var MasterTable = grid.get_masterTableView();
var Rows = MasterTable.get_dataItems();
var selectedItems = grid.get_masterTableView().get_selectedItems();
var count = parseInt(document.getElementById("<%=hdnCount.ClientID%>").value);
if (Rows.length == 0) {
if (sender.get_text() == "Update Annotation")
alert('There are no records to update annotation.');
else if (sender.get_text() == "Send For Review")
alert('There are no records to Send for review.');
args.set_cancel(true);
}
else if (selectedItems.length == 0 && count == 0) {
if (sender.get_text() == "Update Annotation")
alert('Please select atleast 1 record to update annotation.');
else if (sender.get_text() == "Send For Review")
alert('Please select atleast 1 record to Send for review.');
args.set_cancel(true);
}
else { // var agree = confirm("Are you sure you want to De-activate ?");
// if (agree)
args.set_cancel(false);
// else
// args.set_cancel(true);
// window.open("Manage.aspx")
} }
function RadGrid1_RowSelected(sender, args) {
var mailID = args.getDataKeyValue("CashTransactionID");
if (!selected[mailID]) {
selected[mailID] = true;
}
document.getElementById("<%=hdnCount.ClientID%>").value = parseInt(document.getElementById("<%=hdnCount.ClientID%>").value) + 1;
} //To decrease the counter when a row is removed from deactivate selection list
function RadGrid1_RowDeselected(sender, args) { var mailID = args.getDataKeyValue("CashTransactionID");
if (selected[mailID]) {
//window.selected.length = 0;
}
document.getElementById("<%=hdnCount.ClientID%>").value = parseInt(document.getElementById("<%=hdnCount.ClientID%>").value) - 1;
}
function AuthorisePopUp(result) {
var options = {
url: '<asp:Literal runat="server" Text="<%$SPUrl:~Site/Pages/AuthoriseCashMonitoringExceptionPopUp.aspx?Type=NotReview&CashTransactionID=%>" />' + result,
title: 'Review : Cash Monitoring Exception',
allowMaximize: false,
showClose: true,
width: 1300,
height: 700,
dialogReturnValueCallback: RefreshResult
};
SP.UI.ModalDialog.showModalDialog(options);
return false;
}
function RowDblClick(sender, eventArgs) {
var id = eventArgs.getDataKeyValue("CashTransactionID");
var options = {
url: '<asp:Literal runat="server" Text="<%$SPUrl:~Site/Pages/AuthoriseCashMonitoringExceptionPopUp.aspx?Type=AuthoriseReview&CashTransactionID=%>" />' + id,
title: 'View : Cash Monitoring Exception',
allowMaximize: false,
showClose: true,
width: 1200,
height: 700
};
SP.UI.ModalDialog.showModalDialog(options);
}
function OpenPopUpForAnnotation() {
var popup = {
// url: '<asp:Literal runat="server" Text="<%$SPUrl:~Site/Pages/AnnotationUpdate.aspx?CashTransactionID=%>" />' + CashTransactionID,
url: '<asp:Literal runat="server" Text="<%$SPUrl:~Site/Pages/AnnotationUpdate.aspx%>" />',
title: 'Annotation',
allowMaximize: false,
showClose: true,
width: 700,
height: 300,
dialogReturnValueCallback: RefreshResult
};
SP.UI.ModalDialog.showModalDialog(popup);
}
function RefreshResult() {
document.getElementById("<%=hdnPostBack.ClientID%>").value = "true";
__doPostBack("<%=UpdatePanelMain.ClientID %>", ""); }
</script>
<asp:UpdateProgress ID="upLoadingSearch" runat="server">
<ProgressTemplate>
<div id="progressBackgroundFilter">
</div>
<div id="processMessage">
<table border="1" id="table2" cellspacing="4" cellpadding="3" style="background: url('<asp:Literal runat='server' Text='<%$SPUrl:~SiteCollection/Style Library/AIFMDResources/Images/sprite.gif%>' />') #d3dbe9 repeat-x 0px
-200px; border: 1px; border-color: #3b5a82; width: 150px; height: 100px;">
<tr>
<td class="FieldHeader" align="center">
<asp:Image ID="Image2" ImageUrl="<%$SPUrl:~SiteCollection/Style Library/AIFMDResources/Images/waiting.gif%>"
runat="server" AlternateText="Loading..." ToolTip="Loading" />
<br />
Loading...
</td>
</tr>
</table>
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1"></telerik:RadAjaxLoadingPanel>
<asp:UpdatePanel ID="UpdatePanelMain" runat="server" OnLoad="UpdatePanelMain_Load">
<ContentTemplate>
<asp:Label ID="lblStatusMsg" runat="server" class="statusmsg"></asp:Label>
<table width="1230px" cellpadding="0" cellspacing="0">
<tr>
<td style="width: 20%;" class="cheklist_SubHeadingTD">
<div id="divTemplateCreateAccount" runat="server">
<table width="100%" cellpadding="1" cellspacing="0">
<tr>
<td class="cheklist_SubHeading">
Investigate Cash Monitoring Exceptions
</td>
</tr>
<tr>
<td>
<table width="100%" cellpadding="5" cellspacing="1">
<tr>
<td style="width: 20%">
<asp:Label ID="lblClientName" runat="server" CssClass="ms-descriptiontext" Font-Bold="true"
Text="Client:"></asp:Label>
</td>
<td>
<telerik:RadComboBox ID="ddlClients" runat="server" OnSelectedIndexChanged="ddlClients_OnSelectedIndexChanged"
AutoPostBack="true" Width="80%" DropDownWidth="350px" OnDataBound="ddlClients_OnDataBound">
</telerik:RadComboBox>
</td>
<td style="width: 20%">
<asp:Label ID="lblFundNumber" runat="server" CssClass="ms-descriptiontext" Font-Bold="true"
Text="Fund Name:"></asp:Label>
</td>
<td style="width: 30%">
<telerik:RadComboBox ID="ddlFundName" runat="server" OnSelectedIndexChanged="ddlFundName_OnSelectedIndexChanged"
AutoPostBack="true" Width="80%" DropDownWidth="350px" OnDataBound="ddlFundName_OnDataBound">
</telerik:RadComboBox>
</td>
</tr>
<tr>
<td style="width: 20%">
<asp:Label ID="lblFundName" runat="server" CssClass="ms-descriptiontext" Font-Bold="true"
Text="Fund Code:"></asp:Label>
</td>
<td style="width: 30%">
<asp:TextBox ID="txtFundNumber" Width="79%" runat="server" OnTextChanged="txtFundNumber_TextChanged"
AutoPostBack="true"></asp:TextBox>
</td>
<td>
<asp:Label ID="lblAccountCurrency" runat="server" CssClass="ms-descriptiontext" Font-Bold="true"
Text="Currency:"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtAccountCurrency" runat="server" Width="79%" ReadOnly="true"></asp:TextBox>
</td>
</tr>
<tr style="display: none;">
<td>
<asp:Label ID="lblAccountNumber" runat="server" CssClass="ms-descriptiontext" Font-Bold="true"
Text="Account Name:"></asp:Label>
</td>
<td>
<telerik:RadComboBox ID="ddlAccountName" runat="server" Width="80%" AutoPostBack="true"
OnSelectedIndexChanged="ddlAccountNumber_OnSelectedIndexChanged">
</telerik:RadComboBox>
</td>
<td>
<asp:Label ID="lblAccountName" runat="server" CssClass="ms-descriptiontext" Font-Bold="true"
Text="Account Number:"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtAccountNumber" runat="server" ReadOnly="true" Width="79%"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 20%">
<asp:Label ID="lblSearchBY" runat="server" CssClass="ms-descriptiontext" Font-Bold="true"
Text="Search By:"></asp:Label>
</td>
<td>
<asp:RadioButtonList ID="rblSearchOption" runat="server" RepeatDirection="Horizontal">
<%--<asp:ListItem Text="Transaction Date" Value="TD"></asp:ListItem>--%>
<asp:ListItem Selected="True" Text="Actual value Date" Value="AVD"></asp:ListItem>
<asp:ListItem Text="Entry Date" Value="ED"></asp:ListItem>
</asp:RadioButtonList>
</td>
<td>
<asp:Label ID="lblStatementDate" runat="server" CssClass="ms-descriptiontext" Font-Bold="true"
Text="Date:"></asp:Label>
</td>
<td>
<SharePoint:DateTimeControl ID="ActualValueDate" runat="server" DateOnly="true" LocaleId="2057" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="right">
<telerik:RadButton Text="Search" CssClass="ms-descriptiontext" Font-Bold="true" ID="btnSave"
OnClick="btnSearch_Click" runat="server" Width="110px" Font-Size="14px" Skin="Office2010Silver">
</telerik:RadButton>
<telerik:RadButton Text="Reset" CssClass="ms-descriptiontext" Font-Bold="true" ID="btnCancel"
OnClick="btnCancel_Click" runat="server" Width="110px" Font-Size="14px" Skin="Office2010Silver">
</telerik:RadButton>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<table width="1230px" style="table-layout: fixed;">
<tr style="height: 35px">
<td>
</td>
</tr>
</table>
<telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel" LoadingPanelID="RadAjaxLoadingPanel1" >
<table width="1230px" cellpadding="0" cellspacing="0" style="table-layout: fixed;">
<tr>
<td class="cheklist_SubHeadingTD">
<table id="tblSearchStatement" width="100%" cellpadding="10" cellspacing="0" style="table-layout: fixed;">
<tr>
<td class="cheklist_SubHeading">
Search Result
</td>
</tr>
<tr>
<td style="height: 20px" align="right">
<asp:Label ID="lblExportExcel" runat="server" Font-Bold="true" CssClass="Label" Text="Export to: "></asp:Label>
<asp:LinkButton ID="lnkSRExportExcel" runat="server" Font-Bold="true" OnClick="lnkExport_Clck"
Text="Excel" CssClass="Label" ToolTip="Export to Excel">
</asp:LinkButton>
</td>
</tr>
<tr>
<td width="100%">
<telerik:RadGrid ID="grdAuthorizeException" runat="server" AllowFilteringByColumn="true" EnableAJAX="true" EnableAJAXLoadingTemplate="true"
AllowPaging="true" AllowSorting="true" AlternatingItemStyle-BackColor="#E8E8E8" AllowCustomPaging="true"
AllowMultiRowSelection="true" AutoGenerateColumns="false" HeaderStyle-Font-Bold="true"
OnItemDataBound="grdAuthorizeException_ItemDataBound" OnNeedDataSource="grdAuthorizeException_NeedDataSource"
PageSize="10" Skin="Office2010Silver" OnDataBound="grdAuthorizeException_DataBound"
OnPageSizeChanged="grdAuthorizeException_PageSizeChanged" OnPageIndexChanged="grdAuthorizeException_PageIndexChanged"
Width="99%">
<GroupingSettings CaseSensitive="false" />
<HeaderStyle Width="120px" />
<AlternatingItemStyle BackColor="#E8E8E8" />
<MasterTableView AllowFilteringByColumn="true" AllowMultiColumnSorting="true" ClientDataKeyNames="CashTransactionID"
EnableNoRecordsTemplate="true" NoMasterRecordsText="No results found." ShowHeadersWhenNoRecords="true"
Width="100%">
<NoRecordsTemplate>
<asp:Label ID="lblNoRecords" Text="No results found." runat="server" Height="20px"></asp:Label>
</NoRecordsTemplate>
<CommandItemSettings ExportToPdfText="Export to PDF" />
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
</ExpandCollapseColumn>
<Columns>
<telerik:GridClientSelectColumn UniqueName="CheckboxSelectColumn" ItemStyle-HorizontalAlign="Center"
HeaderStyle-Width="50px">
</telerik:GridClientSelectColumn>
<telerik:GridTemplateColumn AllowFiltering="true" HeaderText="Action(s)" UniqueName="Action">
<ItemTemplate>
<asp:LinkButton ID="lnkbtnAuthorize" runat="server" Style="color: #0066CC;" Text="Review"></asp:LinkButton>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="CashTransactionID" Display="false" HeaderText="CashTransactionID"
ItemStyle-CssClass="textwrap" SortExpression="CashTransactionID" UniqueName="CashTransactionID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="LocalAccountNumber" HeaderText="Account Number"
ItemStyle-CssClass="textwrap" FilterControlWidth="80px" SortExpression="LocalAccountNumber"
UniqueName="LocalAccountNumber">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn AllowFiltering="true" DataField="FundCode" FilterControlWidth="80px"
HeaderText="Fund Code" ItemStyle-CssClass="textwrap" SortExpression="FundCode"
UniqueName="FundCode">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn AllowFiltering="true" DataField="FundName" HeaderText="FundName"
ItemStyle-CssClass="textwrap" SortExpression="FundName" FilterControlWidth="80px"
UniqueName="FundName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn AllowFiltering="true" DataField="clientName" FilterControlWidth="80px"
HeaderText="Client" ItemStyle-CssClass="textwrap" SortExpression="Client" UniqueName="Client">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn AllowFiltering="true" DataField="BrokerName" HeaderText="Narrative"
ItemStyle-CssClass="textwrap" FilterControlWidth="80px" SortExpression="BrokerName"
UniqueName="BrokerName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn AllowFiltering="true" DataField="LedgerCode" FilterControlWidth="80px"
HeaderText="Ledger/Statement Code" ItemStyle-CssClass="textwrap" SortExpression="LedgerCode"
UniqueName="LedgerCode">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn AllowFiltering="true" DataField="DCType" FilterControlWidth="80px"
HeaderText="DC Type" ItemStyle-CssClass="textwrap" SortExpression="DCType" UniqueName="DCType">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn AllowFiltering="true" DataField="Currency" HeaderText="Transaction Currency"
ItemStyle-CssClass="textwrap" FilterControlWidth="80px" SortExpression="Currency"
UniqueName="Currency">
</telerik:GridBoundColumn>
<telerik:GridNumericColumn AllowFiltering="true" DataField="dblTransactionAmnt" DataFormatString="{0:N}"
DataType="System.Int32" FilterControlWidth="80px" HeaderText="Transaction Amount"
ItemStyle-HorizontalAlign="Right" ItemStyle-CssClass="textwrap" SortExpression="dblTransactionAmnt"
UniqueName="dblTransactionAmnt">
</telerik:GridNumericColumn>
<telerik:GridBoundColumn AllowFiltering="true" DataField="BaseCurrency" HeaderText="Base Currency"
ItemStyle-CssClass="textwrap" FilterControlWidth="80px" SortExpression="BaseCurrency"
UniqueName="BaseCurrency">
</telerik:GridBoundColumn>
<telerik:GridNumericColumn AllowFiltering="true" DataField="BaseAmount" DataFormatString="{0:N}"
DataType="System.Int32" FilterControlWidth="80px" HeaderText="Transaction Amount (Base Ccy)"
ItemStyle-HorizontalAlign="Right" ItemStyle-CssClass="textwrap" SortExpression="BaseAmount"
UniqueName="BaseAmount">
</telerik:GridNumericColumn>
<telerik:GridDateTimeColumn AllowFiltering="true" DataField="EffectiveDate" DataFormatString="{0:dd/MM/yyyy}"
FilterControlWidth="80px" FilterDateFormat="dd/MM/yyyy" HeaderText="Entry Date"
ItemStyle-CssClass="textwrap" PickerType="None" SortExpression="EffectiveDate"
UniqueName="EffectiveDateStr">
</telerik:GridDateTimeColumn>
<telerik:GridDateTimeColumn AllowFiltering="true" DataField="ActualValueDate" DataFormatString="{0:dd/MM/yyyy}"
FilterControlWidth="80px" FilterDateFormat="dd/MM/yyyy" HeaderText="Actual Value Date"
ItemStyle-CssClass="textwrap" PickerType="None" SortExpression="ActualValueDate"
UniqueName="ActualValueDateStr">
</telerik:GridDateTimeColumn>
<telerik:GridBoundColumn AllowFiltering="true" DataField="CashGroup" HeaderText="Cash Group Code"
ItemStyle-CssClass="textwrap" FilterControlWidth="80px" SortExpression="CashGroup"
UniqueName="CashGroup">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn AllowFiltering="true" DataField="TransactionCode" HeaderText="Transaction Code"
ItemStyle-CssClass="textwrap" FilterControlWidth="80px" SortExpression="TransactionCode"
UniqueName="TransactionCode">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn AllowFiltering="true" DataField="CashRule" FilterControlWidth="80px"
HeaderText="Cash Rule" ItemStyle-CssClass="textwrap" SortExpression="CashRule"
UniqueName="CashRule">
</telerik:GridBoundColumn>
<telerik:GridNumericColumn AllowFiltering="true" DataField="dblPercentageNAVValue"
HeaderText="% NAV Value" ItemStyle-CssClass="textwrap" FilterControlWidth="80px"
SortExpression="dblPercentageNAVValue" DataFormatString="{0:N}" UniqueName="PercentageNAVValue"
DataType="System.Int32" ItemStyle-HorizontalAlign="Right">
</telerik:GridNumericColumn>
<telerik:GridNumericColumn AllowFiltering="true" DataField="NAVValue" DataFormatString="{0:N}"
DataType="System.Int32" FilterControlWidth="80px" HeaderText="Fund NAV (Base Ccy)"
ItemStyle-HorizontalAlign="Right" ItemStyle-CssClass="textwrap" SortExpression="NAVValue"
UniqueName="NAVValue">
</telerik:GridNumericColumn>
<telerik:GridBoundColumn AllowFiltering="true" DataField="MonitorFlag" HeaderText="MonitorFlag"
ItemStyle-CssClass="textwrap" FilterControlWidth="80px" SortExpression="MonitorFlag"
UniqueName="MonitorFlag">
</telerik:GridBoundColumn>
<telerik:GridNumericColumn AllowFiltering="true" DataField="RelationID" DataFormatString="{0:D}"
DataType="System.Int32" HeaderText="Relationship ID" ItemStyle-CssClass="textwrap"
ItemStyle-HorizontalAlign="Right" SortExpression="RelationID" FilterControlWidth="80px"
UniqueName="RelationID">
</telerik:GridNumericColumn>
<telerik:GridBoundColumn AllowFiltering="true" FilterControlWidth="80px" DataField="CashMonitoringAnnotation"
HeaderText="Annotation" ItemStyle-CssClass="textwrap" SortExpression="CashMonitoringAnnotation"
UniqueName="CashMonitoringAnnotation">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn AllowFiltering="true" DataField="UpdatedBy" HeaderText="Updated By"
ItemStyle-CssClass="textwrap" FilterControlWidth="80px" SortExpression="UpdatedBy"
UniqueName="UpdatedBy">
</telerik:GridBoundColumn>
<telerik:GridDateTimeColumn AllowFiltering="true" DataField="UpdatedDate" DataFormatString="{0:dd/MM/yyyy HH:mm:ss}"
FilterControlWidth="80px" FilterDateFormat="dd/MM/yyyy HH:mm:ss" HeaderText="Updated Date"
ItemStyle-CssClass="textwrap" PickerType="None" SortExpression="UpdatedDate"
UniqueName="UpdatedDate">
</telerik:GridDateTimeColumn>
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
</EditColumn>
</EditFormSettings>
<PagerStyle AlwaysVisible="true" PageSizes="10,20,50,100,500,1000" Mode="NextPrevAndNumeric"/>
</MasterTableView>
<ClientSettings Selecting-AllowRowSelect="true">
<Scrolling AllowScroll="True" UseStaticHeaders="true" SaveScrollPosition="True" ScrollHeight="400px" />
<Selecting CellSelectionMode="None" UseClientSelectColumnOnly="true" />
<ClientEvents OnRowSelecting="RadGrid1_RowSelected" OnRowDeselecting="RadGrid1_RowDeselected"
OnRowDblClick="RowDblClick" />
<%-- <Virtualization EnableCurrentPageScrollOnly="true" InitiallyCachedItemsCount="1000" EnableVirtualization="true" LoadingPanelID="RadAjaxLoadingPanel1" ItemsPerView="100" />--%>
</ClientSettings>
<HeaderStyle Font-Bold="True" />
<FilterMenu EnableImageSprites="False">
</FilterMenu>
</telerik:RadGrid>
</td>
</tr>
<tr id="CreteNewButton" runat="server">
<td align="right">
<telerik:RadButton Text="Update Annotation" CssClass="ms-descriptiontext" Skin="Office2010Silver"
OnClick="btnUpdateAnnotation_Click" Font-Bold="true" ID="btnUpdateAssetGroup"
runat="server" OnClientClicking="ValidateSelect" Font-Size="14px">
</telerik:RadButton>
<telerik:RadButton Text="Send For Review" CssClass="ms-descriptiontext" OnClick="btnSendForReview_Click"
Font-Bold="true" ID="btnReview" runat="server" Skin="Office2010Silver" OnClientClicking="ValidateSelect"
Font-Size="14px">
</telerik:RadButton>
</td>
</tr>
<%-- <tr>
<td align="right">
<telerik:RadButton Text="Remove Filters" CssClass="ms-descriptiontext" Font-Bold="true" ID="RemoveFilter"
OnClick="RemoveFilter_Click" runat="server" Width="110px" Font-Size="14px" Skin="Office2010Silver">
</telerik:RadButton>
</td>
</tr>--%>
</table>
</td>
</tr>
</table>
</telerik:RadAjaxPanel>
<asp:HiddenField ID="hdnPopUp" runat="server" />
<asp:HiddenField ID="hdnPostBack" runat="server" />
<asp:HiddenField ID="hdnCount" runat="server" Value="0" />
</ContentTemplate>
</asp:UpdatePanel>
.cs file:
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;
using BNYM.EDS.AIFMD.Component.Modal;
using BNYM.EDS.AIFMD.Component.BusinessLogic;
using BNYM.SHP.Sharepoint.Framework.Logging;
using Telerik.Web.UI;
using Microsoft.SharePoint;
using System.IO;
using System.Linq;
using System.Collections;namespace BNYM.EDS.AIFMD.View.AuthoriseCashMonitoringExceptions
{
public partial class AuthoriseCashMonitoringExceptionsUserControl : UserControl
{
#region Private Variables
private IList<ICashMonitoringEntity> lstCashMonitoringEntity;
private CashMonitoring objAIFMDPresenter;
private ICashMonitoringEntity objIAIFMD;
public ArrayList arrayList = new ArrayList();
Guid webId = SPContext.Current.Web.ID;
private IList<IRecordKeepingEntity> lstRecordKeepingEntity;
private RecordKeeping objRecordKeeping;
private IRecordKeepingEntity objIRecordKeepingEntity;
#endregion #region Page Events
protected void Page_Load(object sender, EventArgs e)
{
System.Web.UI.ScriptManager.GetCurrent(Page).RegisterPostBackControl(btnCancel);
System.Web.UI.ScriptManager.GetCurrent(Page).RegisterPostBackControl(btnSave);
System.Web.UI.ScriptManager.GetCurrent(Page).RegisterPostBackControl(lnkSRExportExcel);
EnsureUpdatePanelFixups();
try
{ if (grdAuthorizeException.Items.Count == 0 && !ActualValueDate.IsDateEmpty)
{ grdAuthorizeException.MasterTableView.NoMasterRecordsText = "No Cash Exceptions available for " + ActualValueDate.SelectedDate.ToString("dd/MM/yyy") + " for the client and fund selected";
}
if (!IsPostBack)
{
Session["Authorized_SearchResult"] = null;
ddlFundName.Enabled = false;
ddlAccountName.Enabled = false;
LoadClientDetails();
lblStatusMsg.Visible = false;
Page.SetFocus(ddlClients);
grdAuthorizeException.MasterTableView.NoMasterRecordsText = "No results found.";
}
}
catch (Exception ex)
{
Logging.LogMessages("EDS- AIFMD : " + ex.Message + "==>" + ex.StackTrace, Logging.LogEntryType.Error);
}
finally
{
lstCashMonitoringEntity = null;
objAIFMDPresenter = null;
objIAIFMD = null;
}
Logging.LogMessages("EDS - AIFMD : Exit from AIFMD Page_Load ", Logging.LogEntryType.Error);
}
#endregion #region Private Methods
/// <summary>
/// Ensure a update panel fix ups.
/// </summary>
private void EnsureUpdatePanelFixups()
{
System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(AuthoriseCashMonitoringExceptionsUserControl),
"UpdatePanelFixup",
"_spOriginalFormAction = document.forms[0].action;" +
"_spSuppressFormOnSubmitWrapper=true;",
true);
} /// <summary>
/// Loads a currency details on the basis of Account Name
/// </summary>
private void LoadCurrencyDetails()
{
lstCashMonitoringEntity = new List<ICashMonitoringEntity>();
objAIFMDPresenter = new CashMonitoring();
objIAIFMD = new CashMonitoringEntity();
//objIAIFMD.accountName = ddlAccountName.SelectedItem.Text;
objIAIFMD.fundID = Convert.ToInt32(ddlFundName.SelectedValue.ToString());
lstCashMonitoringEntity = objAIFMDPresenter.GetCurrency(objIAIFMD);
if (lstCashMonitoringEntity.Count > 0)
{
txtAccountCurrency.Text = lstCashMonitoringEntity[0].CurrencyName;
}
} /// <summary>
/// Loads a client Details dropdown
/// </summary>
private void LoadClientDetails()
{
lstCashMonitoringEntity = new List<ICashMonitoringEntity>();
objAIFMDPresenter = new CashMonitoring();
objIAIFMD = new CashMonitoringEntity();
Guid siteId = SPContext.Current.Web.ID;
objIAIFMD.webID = siteId; lstCashMonitoringEntity = objAIFMDPresenter.GetClientDetails(objIAIFMD);
ddlClients.DataSource = lstCashMonitoringEntity;
ddlClients.DataTextField = "clientName";
ddlClients.DataValueField = "clientID";
ddlClients.DataBind();
RadComboBoxItem radComboItem = new RadComboBoxItem();
radComboItem.Text = "Select";
radComboItem.Value = "0";
ddlClients.Items.Insert(0, radComboItem);
} /// <summary>
/// Loads a Fund Number on the basis of Fund Number
/// </summary>
private void LoadFundNumberDetails()
{
lstCashMonitoringEntity = new List<ICashMonitoringEntity>();
objAIFMDPresenter = new CashMonitoring();
objIAIFMD = new CashMonitoringEntity();
objIAIFMD.clientID = Convert.ToInt32(ddlClients.SelectedValue.ToString());
lstCashMonitoringEntity = objAIFMDPresenter.GetFundDetails(objIAIFMD);
ddlFundName.Items.Clear();
if (lstCashMonitoringEntity.Count > 0)
{
Session["Fund_Code"] = lstCashMonitoringEntity[0].FundCode;
ddlFundName.DataSource = lstCashMonitoringEntity;
ddlFundName.DataTextField = "fundName";
ddlFundName.DataValueField = "fundID";
ddlFundName.DataBind();
}
RadComboBoxItem radComboItem = new RadComboBoxItem();
radComboItem.Text = "Select";
radComboItem.Value = "0";
ddlFundName.Items.Insert(0, radComboItem);
} /// <summary>
/// Loads an Account Name on the basis of Fund Name
/// </summary>
private void GetAccountNameDetails()
{
lstCashMonitoringEntity = new List<ICashMonitoringEntity>();
objAIFMDPresenter = new CashMonitoring();
objIAIFMD = new CashMonitoringEntity();
objIAIFMD.fundID = Convert.ToInt32(ddlFundName.SelectedValue.ToString());
lstCashMonitoringEntity = objAIFMDPresenter.GetAccountNameDetails(objIAIFMD);
ddlAccountName.Items.Clear();
if (lstCashMonitoringEntity.Count > 0)
{
ddlAccountName.DataSource = lstCashMonitoringEntity;
ddlAccountName.DataTextField = "accountName";
ddlAccountName.DataValueField = "accountID";
ddlAccountName.DataBind();
RadComboBoxItem radComboItem = new RadComboBoxItem();
radComboItem.Text = "Select";
radComboItem.Value = "0";
ddlAccountName.Items.Insert(0, radComboItem);
}
} /// <summary>
/// Loads an account Number on the basis of Account Name
/// </summary>
private void GetAccountIDDetails()
{
lstCashMonitoringEntity = new List<ICashMonitoringEntity>();
objAIFMDPresenter = new CashMonitoring();
objIAIFMD = new CashMonitoringEntity();
objIAIFMD.accountName = ddlAccountName.SelectedItem.Text;
lstCashMonitoringEntity = objAIFMDPresenter.GetAccountIDDetails(objIAIFMD);
if (lstCashMonitoringEntity.Count > 0)
{
txtAccountNumber.Text = lstCashMonitoringEntity[0].accountCode.ToString();
}
} private void GetFundCode(int FundID)
{
lstCashMonitoringEntity = new List<ICashMonitoringEntity>();
objAIFMDPresenter = new CashMonitoring();
objIAIFMD = new CashMonitoringEntity();
objIAIFMD.fundID = FundID;
lstCashMonitoringEntity = objAIFMDPresenter.GetFundCode(objIAIFMD);
txtFundNumber.Text = lstCashMonitoringEntity[0].FundCode.ToString();
} /// <summary>
/// Clears all the controls
/// </summary>
private void ClearControls()
{
txtFundNumber.Text = string.Empty;
ddlAccountName.Items.Clear();
ddlAccountName.Enabled = false;
txtAccountNumber.Text = string.Empty;
txtAccountCurrency.Text = string.Empty;
ddlFundName.Items.Clear();
ddlFundName.Enabled = false;
ddlClients.SelectedValue = "0";
ActualValueDate.ClearSelection();
////grdAuthorizeException.DataSource = string.Empty;
////grdAuthorizeException.DataBind();
Session["Authorized_SearchResult"] = null;
foreach (GridColumn column in grdAuthorizeException.MasterTableView.Columns)
{
column.CurrentFilterFunction = GridKnownFunction.NoFilter;
column.CurrentFilterValue = String.Empty;
}
grdAuthorizeException.MasterTableView.FilterExpression = String.Empty;
grdAuthorizeException.DataSource = string.Empty;
grdAuthorizeException.MasterTableView.NoMasterRecordsText = "No results found.";
grdAuthorizeException.DataBind();
lblStatusMsg.Visible = false;
hdnPopUp.Value = "1";
} private void SearchExceptipns()
{
try
{
Session["Authorized_SearchResult"] = null;
lstCashMonitoringEntity = new List<ICashMonitoringEntity>();
objAIFMDPresenter = new CashMonitoring();
objIAIFMD = new CashMonitoringEntity(); objIAIFMD.webID = webId;
objIAIFMD.clientID = Convert.ToInt32(ddlClients.SelectedValue.ToString());
if (!string.IsNullOrEmpty(ddlFundName.SelectedValue.ToString()))
objIAIFMD.fundID = Convert.ToInt32(ddlFundName.SelectedValue.ToString());
if (!string.IsNullOrEmpty(ddlAccountName.SelectedValue.ToString()))
//objIAIFMD.LocalAccountNumber = ddlAccountName.SelectedValue.ToString();
objIAIFMD.accountID = Convert.ToInt32(ddlAccountName.SelectedValue.ToString());
if (!ActualValueDate.IsDateEmpty)
objIAIFMD.ActualValueDate = Convert.ToDateTime(ActualValueDate.SelectedDate.ToShortDateString());
objIAIFMD.SearchBy = rblSearchOption.SelectedValue.ToString();
lstCashMonitoringEntity = objAIFMDPresenter.GetExceptions(objIAIFMD);
if (lstCashMonitoringEntity[0].ExceptionMessage == null)
{
grdAuthorizeException.MasterTableView.VirtualItemCount = lstCashMonitoringEntity.Count;
grdAuthorizeException.DataSource = lstCashMonitoringEntity;
if (!ActualValueDate.IsDateEmpty && lstCashMonitoringEntity.Count == 0)
{ grdAuthorizeException.MasterTableView.NoMasterRecordsText = "No Cash Exceptions available for " + ActualValueDate.SelectedDate.ToString("dd/MM/yyy") + " for the client and fund selected";
}
grdAuthorizeException.DataBind();
Session["Authorized_SearchResult"] = lstCashMonitoringEntity;
}
else
{
grdAuthorizeException.DataSource = string.Empty;
grdAuthorizeException.MasterTableView.NoMasterRecordsText = lstCashMonitoringEntity[0].ExceptionMessage.ToString();
grdAuthorizeException.DataBind();
}
if (Convert.ToString(Session["UpdateStatus"]) != null)
{
if (Convert.ToString(Session["UpdateStatus"]) == "Updated")
{
//lbl_StatusMsg.Visible = true;
lblStatusMsg.Text = "Exception(s) Sent For Review Successfully";
lblStatusMsg.ForeColor = System.Drawing.Color.Green;
Session["UpdateStatus"] = null;
lblStatusMsg.Visible = true;
} }
}
catch (Exception ex)
{
//throw ex;
}
} protected void GetSelectedRows()
{
SessionToArrayList(); foreach (GridDataItem item in grdAuthorizeException.Items)
{
string Result = item["CashTransactionID"].Text; if (item.Selected)
{
if (!arrayList.Contains(Result))
{
arrayList.Add(Result);
}
}
else
{
if (arrayList.Contains(Result))
{
arrayList.Remove(Result);
}
}
}
Session["grdAuthorizeException_SelectedRow"] = arrayList;
} protected void SessionToArrayList()
{
if (Session["grdAuthorizeException_SelectedRow"] != null)
{
arrayList = (ArrayList)Session["grdAuthorizeException_SelectedRow"];
}
} protected void ReSelectedRows()
{
foreach (GridDataItem item in grdAuthorizeException.MasterTableView.Items)
{
string Result = item["CashTransactionID"].Text;
if (arrayList.Contains(Result))
{
item.Selected = true;
}
}
} #endregion #region Control events #region ddlClients_OnSelectedIndexChanged
protected void ddlClients_OnSelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
//Logging.LogMessages("EDS - AIFMD : Entry into the AIFMD ddlClient_OnSelectedIndexChanged", Logging.LogEntryType.Info);
try
{
txtFundNumber.Text = string.Empty;
ddlAccountName.Items.Clear();
ddlAccountName.Enabled = false;
txtAccountNumber.Text = string.Empty;
txtAccountCurrency.Text = string.Empty;
if (ddlClients.SelectedItem.Text == "Select")
{
ddlFundName.Items.Clear();
ddlFundName.Enabled = false;
}
else
{
ddlFundName.Enabled = true;
LoadFundNumberDetails();
} }
catch (Exception ex)
{
Logging.LogMessages("EDS- DPM : " + ex.Message + "==>" + ex.StackTrace, Logging.LogEntryType.Error);
}
finally
{
lstCashMonitoringEntity = null;
objAIFMDPresenter = null;
objIAIFMD = null;
}
//Logging.LogMessages("EDS - AIFMD : Exit from AIFMD ddlClient_OnSelectedIndexChanged ", Logging.LogEntryType.Info); }
#endregion #region ddlFundNumber_OnSelectedIndexChanged
protected void ddlFundName_OnSelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
//Logging.LogMessages("EDS - AIFMD : Entry into the AIFMD ddlFundNumber_OnSelectedIndexChanged", Logging.LogEntryType.Info);
try
{
txtAccountNumber.Text = string.Empty;
txtAccountCurrency.Text = string.Empty;
txtFundNumber.Text = string.Empty;
if (ddlFundName.SelectedItem.Text == "Select")
{
ddlAccountName.Items.Clear();
ddlAccountName.Enabled = false;
}
else
{
ddlAccountName.Enabled = true;
GetFundCode(Convert.ToInt32(ddlFundName.SelectedValue.ToString()));
//txtFundNumber.Text = Session["Fund_Code"].ToString();//ddlFundName.SelectedValue.ToString();
GetAccountNameDetails();
LoadCurrencyDetails();
}
}
catch (Exception ex)
{
Logging.LogMessages("EDS- DPM : " + ex.Message + "==>" + ex.StackTrace, Logging.LogEntryType.Error);
}
finally
{
lstCashMonitoringEntity = null;
objAIFMDPresenter = null;
objIAIFMD = null;
}
//Logging.LogMessages("EDS - AIFMD : Exit from AIFMD ddlFundNumber_OnSelectedIndexChanged ", Logging.LogEntryType.Info); }
#endregion #region ddlAccountNumber_OnSelectedIndexChanged
protected void ddlAccountNumber_OnSelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
//Logging.LogMessages("EDS - AIFMD : Entry into the AIFMD ddlFundNumber_OnSelectedIndexChanged", Logging.LogEntryType.Info);
try
{
if (ddlAccountName.SelectedItem.Text == "Select")
{
txtAccountNumber.Text = string.Empty;
//txtAccountCurrency.Text = string.Empty;
txtFundNumber.Text = string.Empty;
}
else
{
GetAccountIDDetails();
//LoadCurrencyDetails();
}
}
catch (Exception ex)
{
Logging.LogMessages("EDS- DPM : " + ex.Message + "==>" + ex.StackTrace, Logging.LogEntryType.Error);
}
finally
{
lstCashMonitoringEntity = null;
objAIFMDPresenter = null;
objIAIFMD = null;
}
//Logging.LogMessages("EDS - AIFMD : Exit from AIFMD ddlFundNumber_OnSelectedIndexChanged ", Logging.LogEntryType.Info); }
#endregion #region Button Search Click
protected void btnSearch_Click(object sender, EventArgs e)
{
SearchExceptipns();
lblStatusMsg.Visible = false;
hdnPopUp.Value = "2"; }
#endregion #region Button Cancel Click
protected void btnCancel_Click(object sender, EventArgs e)
{
ClearControls();
}
#endregion #region grdAuthorizeException_NeedDataSource
protected void grdAuthorizeException_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
//grdAuthorizeException.DataSource = (Session["Authorized_SearchResult"] != null) ? (List<ICashMonitoringEntity>)Session["Authorized_SearchResult"] : new List<ICashMonitoringEntity>();
//dataSource = (List<ICashMonitoringEntity>)Session["Authorized_SearchResult"];
//grdAuthorizeException.DataSource = dataSource;
if (Session["Authorized_SearchResult"] != null)
{
int startRowIndex = grdAuthorizeException.CurrentPageIndex * grdAuthorizeException.PageSize; int maximumRows = grdAuthorizeException.PageSize; grdAuthorizeException.DataSource = Select(startRowIndex, maximumRows);
}
else
{
grdAuthorizeException.DataSource = new List<ICashMonitoringEntity>();
}
}
#endregion protected void grdAuthorizeException_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
//if (e.Item is GridPagerItem)
//{
// RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox"); // PageSizeCombo.Items.Clear();
// PageSizeCombo.Items.Add(new RadComboBoxItem("10"));
// PageSizeCombo.FindItemByText("10").Attributes.Add("ownerTableViewId", grdAuthorizeException.MasterTableView.ClientID);
// PageSizeCombo.Items.Add(new RadComboBoxItem("20"));
// PageSizeCombo.FindItemByText("20").Attributes.Add("ownerTableViewId", grdAuthorizeException.MasterTableView.ClientID);
// PageSizeCombo.Items.Add(new RadComboBoxItem("50"));
// PageSizeCombo.FindItemByText("50").Attributes.Add("ownerTableViewId", grdAuthorizeException.MasterTableView.ClientID);
// PageSizeCombo.Items.Add(new RadComboBoxItem("100"));
// PageSizeCombo.FindItemByText("100").Attributes.Add("ownerTableViewId", grdAuthorizeException.MasterTableView.ClientID);
// PageSizeCombo.Items.Add(new RadComboBoxItem("500"));
// PageSizeCombo.FindItemByText("500").Attributes.Add("ownerTableViewId", grdAuthorizeException.MasterTableView.ClientID);
// //PageSizeCombo.Items.Add(new RadComboBoxItem("1000"));
// //PageSizeCombo.FindItemByText("1000").Attributes.Add("ownerTableViewId", grdAuthorizeException.MasterTableView.ClientID); // PageSizeCombo.FindItemByText(e.Item.OwnerTableView.PageSize.ToString()).Selected = true; //} if (e.Item.RowIndex >= 0 && e.Item is GridDataItem)
{
GridDataItem dataItem = (GridDataItem)e.Item;
//int CashTransactionID = Convert.ToInt32(dataItem["CashTransactionID"].Text);
//LinkButton lnkAttachment = e.Item.FindControl("lnkAuthorize") as LinkButton;
//lnkAttachment.Attributes["href"] = "#";
//lnkAttachment.Attributes.Add("onclick", "javascript:OpenDialog('" + CashTransactionID + "');"); LinkButton lnkbtnAuthorize = (LinkButton)dataItem.FindControl("lnkbtnAuthorize");
if (lnkbtnAuthorize != null && dataItem["CashTransactionID"] != null)
{
lblStatusMsg.Text = string.Empty;
lnkbtnAuthorize.OnClientClick = "javascript:return AuthorisePopUp(" + dataItem["CashTransactionID"].Text + ");";
}
////if (dataItem["CashMonitoringAnnotation"].Text != string.Empty && dataItem["CashMonitoringAnnotation"].Text != " ")
////{
//// lnkbtnAuthorize.Enabled = false;
////} dataItem["BrokerName"].ToolTip = dataItem["BrokerName"].Text;
if (dataItem["BrokerName"].Text.Length > 15)
{
dataItem["BrokerName"].Text = dataItem["BrokerName"].Text.Substring(0, 15) + "...";
}
dataItem["CashMonitoringAnnotation"].ToolTip = dataItem["CashMonitoringAnnotation"].Text;
if (dataItem["CashMonitoringAnnotation"].Text.Length > 15)
{
dataItem["CashMonitoringAnnotation"].Text = dataItem["CashMonitoringAnnotation"].Text.Substring(0, 15) + "...";
}
}
if (e.Item is GridFilteringItem)
{
GridFilteringItem filerItem = (GridFilteringItem)e.Item;
RadNumericTextBox textItem = (RadNumericTextBox)filerItem["RelationID"].Controls[0];
textItem.NumberFormat.GroupSeparator = "";
} } protected void grdAuthorizeException_PageIndexChanged(object sender, GridPageChangedEventArgs e)
{
try
{
grdAuthorizeException.CurrentPageIndex = e.NewPageIndex;
GetSelectedRows();
}
catch (Exception ex)
{
Logging.LogMessages("AIFMD: Authorise Cash Monitoring Exception - Error in grdAuthorizeException_PageIndexChanged " + ex.Message, Logging.LogEntryType.Error);
Logging.LogMessages("AIFMD: Authorise Cash Monitoring Exception - Error in grdAuthorizeException_PageIndexChanged " + ex.StackTrace, Logging.LogEntryType.Error);
} } protected void grdAuthorizeException_PageSizeChanged(object sender,EventArgs e)
{
try
{
GetSelectedRows();
ReSelectedRows();
}
catch (Exception ex)
{
Logging.LogMessages("AIFMD: Authorise Cash Monitoring Exception - Error in grdAuthorizeException_PageSizeChanged " + ex.Message, Logging.LogEntryType.Error);
Logging.LogMessages("AIFMD: Authorise Cash Monitoring Exception - Error in grdAuthorizeException_PageSizeChanged " + ex.StackTrace, Logging.LogEntryType.Error);
}
}
public List<ICashMonitoringEntity> Select(int startRowIndex, int maximumRows) { List<ICashMonitoringEntity> list = new List<ICashMonitoringEntity>(); int i = startRowIndex; //int pickIndex = i; List<ICashMonitoringEntity> entityList = new List<ICashMonitoringEntity>();
if (Session["Authorized_SearchResult"] != null)
{ entityList = (List<ICashMonitoringEntity>)Session["Authorized_SearchResult"];
}
while (i < Math.Min(100000, startRowIndex + maximumRows)) {
list.Add(entityList[i]); i++; } return list; }
public List<ICashMonitoringEntity> dataSource
{
get
{
object obj = Application["VirtualizationDataSource"]; if (obj == null)
{
List<ICashMonitoringEntity> entityList = new List<ICashMonitoringEntity>();
if (Session["Authorized_SearchResult"] != null)
{ entityList = (List<ICashMonitoringEntity>)Session["Authorized_SearchResult"];
}
Application["VirtualizationDataSource"] = entityList; }
return (List<ICashMonitoringEntity>)Application["VirtualizationDataSource"];
} set
{ Application["VirtualizationDataSource"] = value; } } protected void grdAuthorizeException_DataBound(object sender, EventArgs e)
{
try
{
ReSelectedRows(); }
catch (Exception ex)
{
Logging.LogMessages("AIFMD: Authorise Cash Monitoring Exception - Error in grdAuthorizeException_DataBound " + ex.Message, Logging.LogEntryType.Error);
Logging.LogMessages("AIFMD: Authorise Cash Monitoring Exception - Error in grdAuthorizeException_DataBound " + ex.StackTrace, Logging.LogEntryType.Error);
}
} protected void btnUpdateAnnotation_Click(object sender, EventArgs e)
{
//commented the code for the issue of 500/1000 page size all records are not updating into DB
/*objAIFMDPresenter = new CashMonitoring();
objIAIFMD = new CashMonitoringEntity();
string str = null;
GetSelectedRows();
ArrayList getselected = new ArrayList();
getselected = (ArrayList)Session["grdAuthorizeException_SelectedRow"];
string[] myArray = (string[])getselected.ToArray(typeof(string));
for (int i = 0; i < myArray.Length; i++)
{
str = str + myArray[i] + ",";
}
objIAIFMD.CashTransactionIDstr = str.Substring(0, str.Length - 1);
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "OpenPopUpForAnnotation", "OpenPopUpForAnnotation('" + objIAIFMD.CashTransactionIDstr + "');", true);
hdnCount.Value = "0";
Session["grdAuthorizeException_SelectedRow"] = null;
arrayList = null;*/ GetSelectedRows();
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "OpenPopUpForAnnotation", "OpenPopUpForAnnotation();", true);
hdnCount.Value = "0";
arrayList = null;
} protected void btnSendForReview_Click(object sender, EventArgs e)
{
objAIFMDPresenter = new CashMonitoring();
objIAIFMD = new CashMonitoringEntity();
string str = null;
GetSelectedRows();
ArrayList getselected = new ArrayList();
getselected = (ArrayList)Session["grdAuthorizeException_SelectedRow"];
string[] myArray = (string[])getselected.ToArray(typeof(string));
for (int i = 0; i < myArray.Length; i++)
{
str = str + myArray[i] + ",";
}
objIAIFMD.CashTransactionIDstr = str.Substring(0, str.Length - 1);
objIAIFMD.AuthorizedBy = SPContext.Current.Web.CurrentUser.Name;
objAIFMDPresenter.SendForReviewInBulk(objIAIFMD);
lblStatusMsg.Visible = true;
lblStatusMsg.Text = "Exception(s) Sent For Review Successfully";
lblStatusMsg.ForeColor = System.Drawing.Color.Green;
Session["UpdateStatus"] = "Updated";
hdnCount.Value = "0";
Session["grdAuthorizeException_SelectedRow"] = null;
arrayList = null;
SearchExceptipns();
} protected void txtFundNumber_TextChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txtFundNumber.Text))
{
lstRecordKeepingEntity = new List<IRecordKeepingEntity>();
objRecordKeeping = new RecordKeeping();
objIRecordKeepingEntity = new RecordKeepingEntity();
Guid siteId = SPContext.Current.Web.ID;
objIRecordKeepingEntity.WebGuid = siteId;
objIRecordKeepingEntity.FundCode = Convert.ToString(txtFundNumber.Text);
lstRecordKeepingEntity = objRecordKeeping.GetFundDetailsByFundCode(objIRecordKeepingEntity);
LoadClientDetails();
ddlFundName.Items.Clear();
if (lstRecordKeepingEntity.Count > 0)
{
ddlClients.SelectedValue = lstRecordKeepingEntity[0].clientID.ToString();
ddlClients.SelectedItem.Text = lstRecordKeepingEntity[0].ClientName.ToString();
LoadFundNumberDetails();
ddlFundName.SelectedValue = lstRecordKeepingEntity[0].fundID.ToString();
ddlFundName.SelectedItem.Text = lstRecordKeepingEntity[0].FundName.ToString();
LoadCurrencyDetails();
ddlFundName.Enabled = true;
}
else
{
txtAccountCurrency.Text = string.Empty;
}
////txtNAV.Text = lstRecordKeepingEntity[0].NAV.ToString();
////txtCurrency.Text = lstRecordKeepingEntity[0].CurrencyName.ToString();
////LoadClientDetails();
////ddlFundName.Items.Clear();
}
} #endregion protected void UpdatePanelMain_Load(object sender, EventArgs e)
{
if (hdnPopUp.Value == "2" && hdnPostBack.Value == "true")
{
SearchExceptipns();
hdnPostBack.Value = "False";
} } #region client dropdown tool tip
/// <summary>
/// Client Dropdown list tool tip.
/// </summary> protected void ddlClients_OnDataBound(object sender, EventArgs e)
{
for (int i = 0; i < ddlClients.Items.Count; i++)
{
ddlClients.Items[i].ToolTip = ddlClients.Items[i].Text;
} } #endregion #region Fund Dropdown tool tip
/// <summary>
/// Fund Dropdown list tool tip.
/// </summary>
protected void ddlFundName_OnDataBound(object sender, EventArgs e)
{
for (int i = 0; i < ddlFundName.Items.Count; i++)
{
ddlFundName.Items[i].ToolTip = ddlFundName.Items[i].Text;
} }
#endregion //protected void RemoveFilter_Click(object sender, EventArgs e)
//{
// foreach (GridColumn column in grdAuthorizeException.MasterTableView.Columns)
// {
// column.CurrentFilterFunction = GridKnownFunction.NoFilter;
// column.CurrentFilterValue = String.Empty;
// }
// grdAuthorizeException.MasterTableView.FilterExpression = String.Empty;
// grdAuthorizeException.Rebind();
//} #region Excel Export
protected void lnkExport_Clck(object sender, EventArgs e)
{
try
{
lstCashMonitoringEntity = new List<ICashMonitoringEntity>();
objAIFMDPresenter = new CashMonitoring();
if (Session["Authorized_SearchResult"] != null)
{
lstCashMonitoringEntity = (IList<ICashMonitoringEntity>)Session["Authorized_SearchResult"];
GridView gdvExportDetails = new GridView(); StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
var rptDetails = (from lst in lstCashMonitoringEntity
select new
{
lst.LocalAccountNumber,
lst.FundCode,
lst.fundName,
lst.clientName,
lst.BrokerName,
lst.LedgerCode,
lst.DCType,
lst.Currency,
lst.dblTransactionAmnt,
lst.BaseCurrency,
lst.BaseAmount,
//lst.TransactionDateStr,
lst.EffectiveDateStr,
lst.ActualValueDateStr,
lst.CashGroup,
lst.TransactionCode,
lst.CashRule,
lst.PercentageNAVValue,
lst.NAVValue,
lst.MonitorFlag,
lst.RelationID,
lst.CashMonitoringAnnotation,
lst.UpdatedBy,
lst.UpdatedDateStr });
gdvExportDetails.DataSource = rptDetails;
gdvExportDetails.DataBind();
gdvExportDetails.HeaderRow.Cells[0].Text = "ACCOUNT NUMBER";
gdvExportDetails.HeaderRow.Cells[1].Text = "FUND CODE";
gdvExportDetails.HeaderRow.Cells[2].Text = "FUND NAME";
gdvExportDetails.HeaderRow.Cells[3].Text = "CLIENT";
gdvExportDetails.HeaderRow.Cells[4].Text = "NARRATIVE";
gdvExportDetails.HeaderRow.Cells[5].Text = "LEDGER/STATEMENT CODE";
gdvExportDetails.HeaderRow.Cells[6].Text = "DC TYPE";
gdvExportDetails.HeaderRow.Cells[7].Text = "TRANSACTION CURRENCY";
gdvExportDetails.HeaderRow.Cells[8].Text = "TRANSACTION AMOUNT";
gdvExportDetails.HeaderRow.Cells[9].Text = "BASE CURRENCY";
gdvExportDetails.HeaderRow.Cells[10].Text = "TRANSACTION AMOUNT (Base Ccy)";
////gdvExportDetails.HeaderRow.Cells[11].Text = "TRANSACTION DATE";
gdvExportDetails.HeaderRow.Cells[11].Text = "ENTRY DATE";
gdvExportDetails.HeaderRow.Cells[12].Text = "ACTUAL VALUE DATE";
gdvExportDetails.HeaderRow.Cells[13].Text = "CASH GROUP CODE";
gdvExportDetails.HeaderRow.Cells[14].Text = "TRANSACTION CODE";
gdvExportDetails.HeaderRow.Cells[15].Text = "CASH RULE";
gdvExportDetails.HeaderRow.Cells[16].Text = "% NAV VALUE";
gdvExportDetails.HeaderRow.Cells[17].Text = "FUND NAV (Base Ccy)";
gdvExportDetails.HeaderRow.Cells[18].Text = "MONITOR FLAG";
gdvExportDetails.HeaderRow.Cells[19].Text = "RELATIONSHIP ID";
gdvExportDetails.HeaderRow.Cells[20].Text = "ANNOTATION";
gdvExportDetails.HeaderRow.Cells[21].Text = "UPDATED BY";
gdvExportDetails.HeaderRow.Cells[22].Text = "UPDATED DATE";
gdvExportDetails.AlternatingRowStyle.BackColor = System.Drawing.Color.White;
gdvExportDetails.RowStyle.BackColor = System.Drawing.Color.White;
gdvExportDetails.HeaderStyle.BackColor = System.Drawing.Color.SlateGray;
gdvExportDetails.HeaderStyle.Font.Bold = true;
gdvExportDetails.HeaderStyle.ForeColor = System.Drawing.Color.White;
gdvExportDetails.Attributes.CssStyle["text-align"] = "Left"; gdvExportDetails.RenderControl(htw); string strFileName = "CashMonitoring" + "_" + DateTime.Now.ToString("ddMMyyyy") + ".xls";
Response.ClearContent();
Response.ClearHeaders();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment; filename=" + strFileName);
Response.ContentType = "application/ms-excel";
//Response.Write("<meta http-equiv=Content-Type content=\"text/html; charset=utf-8\">");
Response.Write(sw.ToString());
Response.Flush();
Response.End();
sw = null;
htw = null;
}
else
{
string myScript = @"alert('There is no record to export');";
Page.ClientScript.RegisterStartupScript(this.GetType(),
"MyScript", myScript, true);
}
}
catch (Exception ex)
{
Logging.LogMessages("AIFMD: Activity Checklist Report - Error in btnExport_Click " + ex.Message, Logging.LogEntryType.Error);
Logging.LogMessages("AIFMD: Activity Checklist Report - Error in btnExport_Click " + ex.StackTrace, Logging.LogEntryType.Error);
}
} #endregion
}
}