Good Day all,
I have a big problem but i think its minor for you guys in CodeProject. I am creating a web application that has two main parts. The Payment part and Requisition part. It backbone is using access and the script is in ASP.NET. I managed to sort out most of the application. But I have been having a few problems. I was told to place the code here. So here it is:
ADDREQUISITION.ASPX:
<%@ Register Tagprefix="Selectors" Namespace="PNR" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Tagprefix="PNR" Namespace="PNR.UI.Controls.AddRequisition" %>
<%@ Register Tagprefix="PNR" TagName="ThemeButton" Src="../Shared/ThemeButton.ascx" %>
<%@ Page Language="C#" EnableEventValidation="false" AutoEventWireup="false" CodeFile="AddRequisition.aspx.cs" Culture="en-GB" MasterPageFile="../Master Pages/VerticalMenu.master" Inherits="PNR.UI.AddRequisition" %>
<%@ Register Tagprefix="BaseClasses" Namespace="BaseClasses.Web.UI.WebControls" Assembly="BaseClasses" %><asp:Content id="PageSection" ContentPlaceHolderID="PageContent" Runat="server">
<a id="StartOfPageContent"></a>
<asp:UpdateProgress runat="server" id="UpdatePanel1_UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<div class="ajaxUpdatePanel">
</div>
<div style=" position:absolute; padding:30px;">
<img src="../Images/updating.gif" alt="Updating" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel runat="server" id="UpdatePanel1" UpdateMode="Conditional">
<ContentTemplate>
<input type="hidden" id="_clientSideIsPostBack" name="clientSideIsPostBack" runat="server" />
<table cellpadding="0" cellspacing="0" border="0"><tr><td><%= SystemUtils.GenerateEnterKeyCaptureBeginTag(FindControlRecursively("CancelButton"))%>
<%= SystemUtils.GenerateEnterKeyCaptureBeginTag(FindControlRecursively("EditButton"))%>
<%= SystemUtils.GenerateEnterKeyCaptureBeginTag(FindControlRecursively("OKButton"))%>
<%= SystemUtils.GenerateEnterKeyCaptureBeginTag(FindControlRecursively("SaveAndNewButton"))%>
<%= SystemUtils.GenerateEnterKeyCaptureBeginTag(FindControlRecursively("SaveButton"))%>
<PNR:RequisitionRecordControl runat="server" id="RequisitionRecordControl"> <table class="dv" cellpadding="0" cellspacing="0" border="0"><tr><td class="dh"><table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td class="dhel"><img src="../Images/space.gif" alt="" /></td><td class="dhb"><table cellpadding="0" cellspacing="0" border="0"><tr><td class="dht" valign="middle"><asp:Literal runat="server" id="RequisitionTitle" Text="<%#String.Concat(GetResourceValue("Title:Add")," Requisition") %>"> </asp:Literal></td></tr></table>
</td><td class="dher"><img src="../Images/space.gif" alt="" /></td></tr></table>
</td></tr><tr><td><asp:panel id="RequisitionRecordControlCollapsibleRegion" runat="server"><table class="dBody" cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td><asp:panel id="RequisitionRecordControlPanel" runat="server"><table cellpadding="0" cellspacing="0" border="0"><tr><td class="fls"></td><td class="dfv"></td><td class="fls"><asp:Literal runat="server" id="RefNoLabel" Text="RefNo"> </asp:Literal></td><td class="dfv"><asp:TextBox runat="server" id="RefNo" MaxLength="50" columns="60" cssclass="field_input" rows="5" textmode="MultiLine"></asp:TextBox>
<BaseClasses:TextBoxMaxLengthValidator runat="server" id="RefNoTextBoxMaxLengthValidator" ControlToValidate="RefNo" ErrorMessage="<%# GetResourceValue("Val:ValueTooLong", "PNR").Replace("{FieldName}", "RefNo") %>"></BaseClasses:TextBoxMaxLengthValidator></td></tr><tr><td class="fls"><asp:Literal runat="server" id="TransactionNoLabel" Text="TransactionNo"> </asp:Literal></td><td class="dfv"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="padding-right: 5px; vertical-align:top">
<asp:TextBox runat="server" id="TransactionNo" Columns="14" MaxLength="14" onkeyup="adjustInteger(this, event.keyCode)" cssclass="field_input"></asp:TextBox></td>
<td style="padding-right: 5px; white-space:nowrap;">
<%# SystemUtils.GenerateIncrementDecrementButtons(false, FindControlRecursively("TransactionNo"),"NumberTextBox","","","") %>
</td>
<td>
<BaseClasses:TextBoxMaxLengthValidator runat="server" id="TransactionNoTextBoxMaxLengthValidator" ControlToValidate="TransactionNo" ErrorMessage="<%# GetResourceValue("Val:ValueTooLong", "PNR").Replace("{FieldName}", "TransactionNo") %>"></BaseClasses:TextBoxMaxLengthValidator></td>
</tr>
</table>
</td><td class="fls"><asp:Literal runat="server" id="TransactionDateLabel" Text="TransactionDate"> </asp:Literal></td><td class="dfv"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="padding-right: 5px; vertical-align:top">
<asp:TextBox runat="server" id="TransactionDate" Columns="20" MaxLength="20" cssclass="field_input"></asp:TextBox></td>
<td style="padding-right: 5px; white-space:nowrap;">
</td>
<td>
<Selectors:CalendarExtendarClass runat="server" ID="TransactionDateCalendarExtender" TargetControlID="TransactionDate" CssClass="MyCalendar" Format="D">
</Selectors:CalendarExtendarClass>
<BaseClasses:TextBoxMaxLengthValidator runat="server" id="TransactionDateTextBoxMaxLengthValidator" ControlToValidate="TransactionDate" ErrorMessage="<%# GetResourceValue("Val:ValueTooLong", "PNR").Replace("{FieldName}", "TransactionDate") %>"></BaseClasses:TextBoxMaxLengthValidator></td>
</tr>
</table>
</td></tr><tr><td class="fls"><asp:Literal runat="server" id="AmountLabel" Text="Amount"> </asp:Literal></td><td class="dfv"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="padding-right: 5px; vertical-align:top">
<asp:TextBox runat="server" id="Amount" Columns="20" MaxLength="20" onkeyup="adjustInteger(this, event.keyCode)" cssclass="field_input"></asp:TextBox></td>
<td style="padding-right: 5px; white-space:nowrap;">
<%# SystemUtils.GenerateIncrementDecrementButtons(false, FindControlRecursively("Amount"),"NumberTextBox","","","") %>
</td>
<td>
<BaseClasses:TextBoxMaxLengthValidator runat="server" id="AmountTextBoxMaxLengthValidator" ControlToValidate="Amount" ErrorMessage="<%# GetResourceValue("Val:ValueTooLong", "PNR").Replace("{FieldName}", "Amount") %>"></BaseClasses:TextBoxMaxLengthValidator></td>
</tr>
</table>
</td><td class="fls"><asp:Literal runat="server" id="PreparedDateLabel" Text="PreparedDate"> </asp:Literal></td><td class="dfv"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="padding-right: 5px; vertical-align:top">
<asp:TextBox runat="server" id="PreparedDate" Columns="20" MaxLength="20" cssclass="field_input"></asp:TextBox></td>
<td style="padding-right: 5px; white-space:nowrap;">
</td>
<td>
<Selectors:CalendarExtendarClass runat="server" ID="PreparedDateCalendarExtender" TargetControlID="PreparedDate" CssClass="MyCalendar" Format="D">
</Selectors:CalendarExtendarClass>
<BaseClasses:TextBoxMaxLengthValidator runat="server" id="PreparedDateTextBoxMaxLengthValidator" ControlToValidate="PreparedDate" ErrorMessage="<%# GetResourceValue("Val:ValueTooLong", "PNR").Replace("{FieldName}", "PreparedDate") %>"></BaseClasses:TextBoxMaxLengthValidator></td>
</tr>
</table>
</td></tr><tr><td class="fls"><asp:Literal runat="server" id="CheckedDateLabel" Text="CheckedDate"> </asp:Literal></td><td class="dfv"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="padding-right: 5px; vertical-align:top">
<asp:TextBox runat="server" id="CheckedDate" Columns="20" MaxLength="20" cssclass="field_input"></asp:TextBox></td>
<td style="padding-right: 5px; white-space:nowrap;">
</td>
<td>
<Selectors:CalendarExtendarClass runat="server" ID="CheckedDateCalendarExtender" TargetControlID="CheckedDate" CssClass="MyCalendar" Format="D">
</Selectors:CalendarExtendarClass>
<BaseClasses:TextBoxMaxLengthValidator runat="server" id="CheckedDateTextBoxMaxLengthValidator" ControlToValidate="CheckedDate" ErrorMessage="<%# GetResourceValue("Val:ValueTooLong", "PNR").Replace("{FieldName}", "CheckedDate") %>"></BaseClasses:TextBoxMaxLengthValidator></td>
</tr>
</table>
</td><td class="fls"><asp:Literal runat="server" id="DateRequestedLabel" Text="DateRequested"> </asp:Literal></td><td class="dfv"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="padding-right: 5px; vertical-align:top">
<asp:TextBox runat="server" id="DateRequested" Columns="20" MaxLength="20" cssclass="field_input"></asp:TextBox></td>
<td style="padding-right: 5px; white-space:nowrap;">
</td>
<td>
<Selectors:CalendarExtendarClass runat="server" ID="DateRequestedCalendarExtender" TargetControlID="DateRequested" CssClass="MyCalendar" Format="D">
</Selectors:CalendarExtendarClass>
<BaseClasses:TextBoxMaxLengthValidator runat="server" id="DateRequestedTextBoxMaxLengthValidator" ControlToValidate="DateRequested" ErrorMessage="<%# GetResourceValue("Val:ValueTooLong", "PNR").Replace("{FieldName}", "DateRequested") %>"></BaseClasses:TextBoxMaxLengthValidator></td>
</tr>
</table>
</td></tr><tr><td class="fls"><asp:Literal runat="server" id="AuthorisedDateLabel" Text="AuthorisedDate"> </asp:Literal></td><td class="dfv"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="padding-right: 5px; vertical-align:top">
<asp:TextBox runat="server" id="AuthorisedDate" Columns="20" MaxLength="20" cssclass="field_input"></asp:TextBox></td>
<td style="padding-right: 5px; white-space:nowrap;">
</td>
<td>
<Selectors:CalendarExtendarClass runat="server" ID="AuthorisedDateCalendarExtender" TargetControlID="AuthorisedDate" CssClass="MyCalendar" Format="D">
</Selectors:CalendarExtendarClass>
<BaseClasses:TextBoxMaxLengthValidator runat="server" id="AuthorisedDateTextBoxMaxLengthValidator" ControlToValidate="AuthorisedDate" ErrorMessage="<%# GetResourceValue("Val:ValueTooLong", "PNR").Replace("{FieldName}", "AuthorisedDate") %>"></BaseClasses:TextBoxMaxLengthValidator></td>
</tr>
</table>
</td><td class="fls"><asp:Literal runat="server" id="ExchangeRateLabel" Text="ExchangeRate"> </asp:Literal></td><td class="dfv"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="padding-right: 5px; vertical-align:top">
<asp:TextBox runat="server" id="ExchangeRate" Columns="20" MaxLength="20" onkeyup="adjustInteger(this, event.keyCode)" cssclass="field_input"></asp:TextBox></td>
<td style="padding-right: 5px; white-space:nowrap;">
<%# SystemUtils.GenerateIncrementDecrementButtons(false, FindControlRecursively("ExchangeRate"),"NumberTextBox","","","") %>
</td>
<td>
<BaseClasses:TextBoxMaxLengthValidator runat="server" id="ExchangeRateTextBoxMaxLengthValidator" ControlToValidate="ExchangeRate" ErrorMessage="<%# GetResourceValue("Val:ValueTooLong", "PNR").Replace("{FieldName}", "ExchangeRate") %>"></BaseClasses:TextBoxMaxLengthValidator></td>
</tr>
</table>
</td></tr><tr><td class="fls"></td><td class="dfv" colspan="3"></td></tr><tr><td class="fls"></td><td class="dfv"></td><td class="dfv"></td><td class="dfv"></td></tr><tr><td class="fls"></td><td class="dfv"></td><td class="dfv"></td><td class="dfv"></td></tr><tr><td class="fls"></td><td class="dfv"></td><td class="dfv"></td><td class="dfv"></td></tr><tr><td class="fls"><asp:Literal runat="server" id="PayeeIDLabel" Text="PayeeID"> </asp:Literal></td><td class="dfv" colspan="3" style="white-space:nowrap;"><asp:DropDownList runat="server" id="PayeeID" cssclass="field_input" onkeypress="dropDownListTypeAhead(this,false)"></asp:DropDownList>
<Selectors:FvLlsHyperLink runat="server" id="PayeeIDFvLlsHyperLink" ControlToUpdate="PayeeID" Text="<%# GetResourceValue("LLS:Text", "PNR") %>" MinListItems="100" Table="PayeeDetails" Field="PayeeDetails_.PayeeID" DisplayField="PayeeDetails_.PayeeDesc"></Selectors:FvLlsHyperLink>
<asp:ImageButton runat="server" id="PayeeIDAddRecordLink" causesvalidation="False" commandname="Redirect" imageurl="../Images/iconNewFlat.gif" tooltip="<%# GetResourceValue("Btn:Add", "PNR") %>">
</asp:ImageButton> </td></tr><tr><td class="fls"><asp:Literal runat="server" id="ReasonLabel" Text="Reason"> </asp:Literal></td><td class="dfv" colspan="3"><asp:TextBox runat="server" id="Reason" MaxLength="50" columns="60" cssclass="field_input" rows="5" textmode="MultiLine"></asp:TextBox>
<BaseClasses:TextBoxMaxLengthValidator runat="server" id="ReasonTextBoxMaxLengthValidator" ControlToValidate="Reason" ErrorMessage="<%# GetResourceValue("Val:ValueTooLong", "PNR").Replace("{FieldName}", "Reason") %>"></BaseClasses:TextBoxMaxLengthValidator> </td></tr><tr><td class="fls"><asp:Literal runat="server" id="PayerBankRefLabel" Text="PayerBankRef"> </asp:Literal></td><td class="dfv" colspan="3" style="white-space:nowrap;"><asp:DropDownList runat="server" id="PayerBankRef" cssclass="field_input" onkeypress="dropDownListTypeAhead(this,false)"></asp:DropDownList>
<Selectors:FvLlsHyperLink runat="server" id="PayerBankRefFvLlsHyperLink" ControlToUpdate="PayerBankRef" Text="<%# GetResourceValue("LLS:Text", "PNR") %>" MinListItems="100" Table="PayerBank" Field="PayerBank_.PayerBankRef" DisplayField="PayerBank_.PayerBankName"></Selectors:FvLlsHyperLink>
<asp:ImageButton runat="server" id="PayerBankRefAddRecordLink" causesvalidation="False" commandname="Redirect" imageurl="../Images/iconNewFlat.gif" tooltip="<%# GetResourceValue("Btn:Add", "PNR") %>">
</asp:ImageButton> </td></tr><tr><td class="fls"><asp:Literal runat="server" id="CurrencyPaidInLabel" Text="CurrencyPaidIn"> </asp:Literal></td><td class="dfv" colspan="3"><asp:TextBox runat="server" id="CurrencyPaidIn" MaxLength="50" columns="60" cssclass="field_input" rows="5" textmode="MultiLine"></asp:TextBox>
<BaseClasses:TextBoxMaxLengthValidator runat="server" id="CurrencyPaidInTextBoxMaxLengthValidator" ControlToValidate="CurrencyPaidIn" ErrorMessage="<%# GetResourceValue("Val:ValueTooLong", "PNR").Replace("{FieldName}", "CurrencyPaidIn") %>"></BaseClasses:TextBoxMaxLengthValidator> </td></tr><tr><td class="fls"><asp:Literal runat="server" id="AmountINWordsLabel" Text="AmountINWords"> </asp:Literal></td><td class="dfv" colspan="3"><asp:TextBox runat="server" id="AmountINWords" MaxLength="50" columns="60" cssclass="field_input" rows="5" textmode="MultiLine"></asp:TextBox>
<BaseClasses:TextBoxMaxLengthValidator runat="server" id="AmountINWordsTextBoxMaxLengthValidator" ControlToValidate="AmountINWords" ErrorMessage="<%# GetResourceValue("Val:ValueTooLong", "PNR").Replace("{FieldName}", "AmountINWords") %>"></BaseClasses:TextBoxMaxLengthValidator> </td></tr><tr><td class="fls"><asp:Literal runat="server" id="ModeOfPaymentLabel" Text="ModeOfPayment"> </asp:Literal></td><td class="dfv" colspan="3"><asp:TextBox runat="server" id="ModeOfPayment" MaxLength="50" columns="60" cssclass="field_input" rows="5" textmode="MultiLine"></asp:TextBox>
<BaseClasses:TextBoxMaxLengthValidator runat="server" id="ModeOfPaymentTextBoxMaxLengthValidator" ControlToValidate="ModeOfPayment" ErrorMessage="<%# GetResourceValue("Val:ValueTooLong", "PNR").Replace("{FieldName}", "ModeOfPayment") %>"></BaseClasses:TextBoxMaxLengthValidator> </td></tr><tr><td class="fls"><asp:Literal runat="server" id="ChequeNoLabel" Text="ChequeNo"> </asp:Literal></td><td class="dfv" colspan="3"><asp:TextBox runat="server" id="ChequeNo" MaxLength="50" columns="60" cssclass="field_input" rows="5" textmode="MultiLine"></asp:TextBox>
<BaseClasses:TextBoxMaxLengthValidator runat="server" id="ChequeNoTextBoxMaxLengthValidator" ControlToValidate="ChequeNo" ErrorMessage="<%# GetResourceValue("Val:ValueTooLong", "PNR").Replace("{FieldName}", "ChequeNo") %>"></BaseClasses:TextBoxMaxLengthValidator> </td></tr><tr><td class="fls"><asp:Literal runat="server" id="ElectronicFTIDLabel" Text="ElectronicFTID"> </asp:Literal></td><td class="dfv" colspan="3"><asp:TextBox runat="server" id="ElectronicFTID" MaxLength="50" columns="60" cssclass="field_input" rows="5" textmode="MultiLine"></asp:TextBox>
<BaseClasses:TextBoxMaxLengthValidator runat="server" id="ElectronicFTIDTextBoxMaxLengthValidator" ControlToValidate="ElectronicFTID" ErrorMessage="<%# GetResourceValue("Val:ValueTooLong", "PNR").Replace("{FieldName}", "ElectronicFTID") %>"></BaseClasses:TextBoxMaxLengthValidator> </td></tr><tr><td class="fls"><asp:Literal runat="server" id="StaffIDLabel" Text="StaffID"> </asp:Literal></td><td class="dfv" colspan="3" style="white-space:nowrap;"><asp:DropDownList runat="server" id="StaffID" cssclass="field_input" onkeypress="dropDownListTypeAhead(this,false)"></asp:DropDownList>
<Selectors:FvLlsHyperLink runat="server" id="StaffIDFvLlsHyperLink" ControlToUpdate="StaffID" Text="<%# GetResourceValue("LLS:Text", "PNR") %>" MinListItems="100" Table="Staff" Field="Staff_.StaffID" DisplayField="Staff_.StaffName"></Selectors:FvLlsHyperLink>
<asp:ImageButton runat="server" id="StaffIDAddRecordLink" causesvalidation="False" commandname="Redirect" imageurl="../Images/iconNewFlat.gif" tooltip="<%# GetResourceValue("Btn:Add", "PNR") %>">
</asp:ImageButton> </td></tr><tr><td class="fls"><asp:Literal runat="server" id="ContractNoLabel" Text="ContractNo"> </asp:Literal></td><td class="dfv" colspan="3"><asp:TextBox runat="server" id="ContractNo" MaxLength="50" columns="60" cssclass="field_input" rows="5" textmode="MultiLine"></asp:TextBox>
<BaseClasses:TextBoxMaxLengthValidator runat="server" id="ContractNoTextBoxMaxLengthValidator" ControlToValidate="ContractNo" ErrorMessage="<%# GetResourceValue("Val:ValueTooLong", "PNR").Replace("{FieldName}", "ContractNo") %>"></BaseClasses:TextBoxMaxLengthValidator> </td></tr><tr><td class="fls"><asp:Literal runat="server" id="LedgerCodeLabel" Text="LedgerCode"> </asp:Literal></td><td class="dfv" colspan="3"><asp:TextBox runat="server" id="LedgerCode" MaxLength="50" columns="60" cssclass="field_input" rows="5" textmode="MultiLine"></asp:TextBox>
<BaseClasses:TextBoxMaxLengthValidator runat="server" id="LedgerCodeTextBoxMaxLengthValidator" ControlToValidate="LedgerCode" ErrorMessage="<%# GetResourceValue("Val:ValueTooLong", "PNR").Replace("{FieldName}", "LedgerCode") %>"></BaseClasses:TextBoxMaxLengthValidator> </td></tr><tr><td class="fls"><asp:Literal runat="server" id="SignatoryIDLabel" Text="SignatoryID"> </asp:Literal></td><td class="dfv" colspan="3" style="white-space:nowrap;"><asp:DropDownList runat="server" id="SignatoryID" cssclass="field_input" onkeypress="dropDownListTypeAhead(this,false)"></asp:DropDownList>
<Selectors:FvLlsHyperLink runat="server" id="SignatoryIDFvLlsHyperLink" ControlToUpdate="SignatoryID" Text="<%# GetResourceValue("LLS:Text", "PNR") %>" MinListItems="100" Table="Signatory" Field="Signatory_.SignatoryID" DisplayField="Signatory_.SignatoryID"></Selectors:FvLlsHyperLink>
<asp:ImageButton runat="server" id="SignatoryIDAddRecordLink" causesvalidation="False" commandname="Redirect" imageurl="../Images/iconNewFlat.gif" tooltip="<%# GetResourceValue("Btn:Add", "PNR") %>">
</asp:ImageButton> </td></tr><tr><td class="fls"><asp:Literal runat="server" id="SystemUserIDLabel" Text="SystemUserID"> </asp:Literal></td><td class="dfv" colspan="3" style="white-space:nowrap;"><asp:DropDownList runat="server" id="SystemUserID" cssclass="field_input" onkeypress="dropDownListTypeAhead(this,false)"></asp:DropDownList>
<Selectors:FvLlsHyperLink runat="server" id="SystemUserIDFvLlsHyperLink" ControlToUpdate="SystemUserID" Text="<%# GetResourceValue("LLS:Text", "PNR") %>" MinListItems="100" Table="Users" Field="Users_.UserID" DisplayField="Users_.UserName"></Selectors:FvLlsHyperLink>
<asp:ImageButton runat="server" id="SystemUserIDAddRecordLink" causesvalidation="False" commandname="Redirect" imageurl="../Images/iconNewFlat.gif" tooltip="<%# GetResourceValue("Btn:Add", "PNR") %>">
</asp:ImageButton> </td></tr></table></asp:panel>
</td></tr></table>
</asp:panel></td></tr></table>
</PNR:RequisitionRecordControl>
<%= SystemUtils.GenerateEnterKeyCaptureEndTag(FindControlRecursively("SaveButton"))%>
<%= SystemUtils.GenerateEnterKeyCaptureEndTag(FindControlRecursively("SaveAndNewButton"))%>
<%= SystemUtils.GenerateEnterKeyCaptureEndTag(FindControlRecursively("OKButton"))%>
<%= SystemUtils.GenerateEnterKeyCaptureEndTag(FindControlRecursively("EditButton"))%>
<%= SystemUtils.GenerateEnterKeyCaptureEndTag(FindControlRecursively("CancelButton"))%>
</td></tr><tr><td class="recordPanelButtonsAlignment"><table cellpadding="0" cellspacing="0" border="0"><tr><td><PNR:ThemeButton runat="server" id="SaveButton" button-causesvalidation="True" button-commandname="UpdateData" button-text="<%# GetResourceValue("Btn:Save", "PNR") %>" button-tooltip="<%# GetResourceValue("Btn:Save", "PNR") %>" postback="True"></PNR:ThemeButton></td><td><PNR:ThemeButton runat="server" id="SaveAndNewButton" button-causesvalidation="True" button-commandname="UpdateData" button-text="<%# GetResourceValue("Btn:SaveNNew", "PNR") %>" button-tooltip="<%# GetResourceValue("Btn:SaveNNew", "PNR") %>" postback="True"></PNR:ThemeButton></td><td><PNR:ThemeButton runat="server" id="CancelButton" button-causesvalidation="False" button-commandname="Redirect" button-text="<%# GetResourceValue("Btn:Cancel", "PNR") %>" button-tooltip="<%# GetResourceValue("Btn:Cancel", "PNR") %>" postback="False"></PNR:ThemeButton></td></tr></table>
</td></tr></table>
</ContentTemplate>
</asp:UpdatePanel>
<div id="detailPopup" class="detailRolloverPopup" onmouseout="detailRolloverPopupClose();" onmouseover="clearTimeout(gPopupTimer);"></div>
<asp:ValidationSummary id="ValidationSummary1" ShowMessageBox="true" ShowSummary="false" runat="server"></asp:ValidationSummary>
</asp:Content>
-----------------------------------------------------------------------------------------------
ADDREQUISITION.ASPX.CS
#region "Using statements"
using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BaseClasses;
using BaseClasses.Utils;
using BaseClasses.Data;
using BaseClasses.Data.SqlProvider;
using BaseClasses.Web.UI.WebControls;
using PNR.Business;
using PNR.Data;
#endregion
namespace PNR.UI
{
public partial class AddRequisition
: BaseApplicationPage
{
#region "Section 1: Place your customizations here."
public AddRequisition()
{
this.Initialize();
}
public void SetPageFocus()
{
this.LoadFocusScripts(this.Page);
this.SetFocusOnLoad();
}
public void LoadData()
{
LoadData_Base();
}
private string EvaluateFormula(string formula, BaseClasses.Data.BaseRecord dataSourceForEvaluate, string format, System.Collections.Generic.IDictionary<string,object> variables, bool includeDS)
{
return EvaluateFormula_Base(formula, dataSourceForEvaluate, format, variables, includeDS);
}
public void Page_InitializeEventHandlers(object sender, System.EventArgs e)
{
this.Page_InitializeEventHandlers_Base(sender, e);
}
protected override void SaveControlsToSession()
{
SaveControlsToSession_Base();
}
protected override void ClearControlsFromSession()
{
ClearControlsFromSession_Base();
}
protected override void LoadViewState(object savedState)
{
LoadViewState_Base(savedState);
}
protected override object SaveViewState()
{
return SaveViewState_Base();
}
public void Page_PreRender(object sender, System.EventArgs e)
{
this.Page_PreRender_Base(sender, e);
}
public override void SaveData()
{
this.SaveData_Base();
}
public override void SetChartControl(string chartCtrlName)
{
this.SetChartControl_Base(chartCtrlName);
}
public void Page_PreInit(object sender, System.EventArgs e)
{
try
{
this.PreInit_Base();
}
catch
{
}
}
#region "Ajax Functions"
[System.Web.Services.WebMethod()]
public static Object[] GetRecordFieldValue(string contextName,
string tableName ,
string recordID ,
string columnName,
string fieldName,
string title,
bool persist,
int popupWindowHeight,
int popupWindowWidth,
bool popupWindowScrollBar)
{
return GetRecordFieldValue_Base(contextName, tableName, recordID, columnName, fieldName, title, persist, popupWindowHeight, popupWindowWidth, popupWindowScrollBar);
}
[System.Web.Services.WebMethod()]
public static object[] GetImage(string contextName,
string tableName,
string recordID,
string columnName,
string title,
bool persist,
int popupWindowHeight,
int popupWindowWidth,
bool popupWindowScrollBar)
{
return GetImage_Base(contextName, tableName, recordID, columnName, title, persist, popupWindowHeight, popupWindowWidth, popupWindowScrollBar);
}
protected override void BasePage_PreRender(object sender, EventArgs e)
{
base.BasePage_PreRender(sender, e);
RegisterPostback();
}
protected void RegisterPostback()
{
Base_RegisterPostback();
}
#endregion
public void CancelButton_Click(object sender, EventArgs args)
{
CancelButton_Click_Base(sender, args);
}
public void SaveAndNewButton_Click(object sender, EventArgs args)
{
SaveAndNewButton_Click_Base(sender, args);
}
public void SaveButton_Click(object sender, EventArgs args)
{
SaveButton_Click_Base(sender, args);
}
#endregion
#region "Section 2: Do not modify this section."
private void Initialize()
{
this.Init += new EventHandler(Page_InitializeEventHandlers);
this.PreInit += new EventHandler(Page_PreInit);
this.Load += new EventHandler(Page_Load);
EvaluateFormulaDelegate = new BaseClasses.Data.DataSource.EvaluateFormulaDelegate(EvaluateFormula);
}
public void Page_InitializeEventHandlers_Base(object sender, System.EventArgs e)
{
if(!string.IsNullOrEmpty(this.Enctype)) this.Page.Form.Enctype = this.Enctype;
this.PreRender += new EventHandler(Page_PreRender);
this.CancelButton.Button.Click += CancelButton_Click;
this.SaveAndNewButton.Button.Click += SaveAndNewButton_Click;
this.SaveAndNewButton.Button.Attributes.Add("onclick", "SubmitHRefOnce(this, \"" + this.GetResourceValue("Txt:SaveRecord", "PNR") + "\");");
this.SaveButton.Button.Click += SaveButton_Click;
this.SaveButton.Button.Attributes.Add("onclick", "SubmitHRefOnce(this, \"" + this.GetResourceValue("Txt:SaveRecord", "PNR") + "\");");
this.ClearControlsFromSession();
}
private void Base_RegisterPostback()
{
this.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(this,"SaveAndNewButton"));
this.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(this,"SaveButton"));
}
protected void BasePage_PreRender_Base(object sender, System.EventArgs e)
{
}
protected virtual void Page_Load(object sender, EventArgs e)
{
this.SetPageFocus();
this.Authorize("");
if (!this.IsPostBack)
{
this.ValidationSummary1.HeaderText = GetResourceValue("ValidationSummaryHeaderText", "PNR");
}
System.Web.UI.HtmlControls.HtmlInputHidden clientSideIsPostBack = (System.Web.UI.HtmlControls.HtmlInputHidden)(this.FindControlRecursively("_clientSideIsPostBack"));
if(clientSideIsPostBack != null) {
if(this.IsPostBack && (this.Request["__EVENTTARGET"] != "ChildWindowPostBack")) {
clientSideIsPostBack.Value = "Y";
} else {
clientSideIsPostBack.Value = "N";
}
}
if ((!this.IsPostBack) || ( this.Request["__EVENTTARGET"] == "ChildWindowPostBack")) {
this.LoadData();
}
Page.Title = GetResourceValue("Title:Add") + " Requisition";
}
public static object[] GetRecordFieldValue_Base(string contextName,
string tableName ,
string recordID ,
string columnName,
string fieldName,
string title,
bool persist,
int popupWindowHeight,
int popupWindowWidth,
bool popupWindowScrollBar)
{
if (recordID != ""){
recordID = System.Web.HttpUtility.UrlDecode(recordID);
}
string content = BaseClasses.Utils.MiscUtils.GetFieldData(tableName, recordID, columnName);
content = NetUtils.EncodeStringForHtmlDisplay(content);
object[] returnValue = new object[6];
returnValue[0] = title;
returnValue[1] = content;
returnValue[2] = persist;
returnValue[3] = popupWindowWidth;
returnValue[4] = popupWindowHeight;
returnValue[5] = popupWindowScrollBar;
return returnValue;
}
public static object[] GetImage_Base(string contextName,
string tableName,
string recordID,
string columnName,
string title,
bool persist,
int popupWindowHeight,
int popupWindowWidth,
bool popupWindowScrollBar)
{
string content;
if (contextName != null && contextName != "NULL")
{
content = "<IMG alt =\"" + title + "\" src =" + "\"../Shared/ExportFieldValue.aspx?Context=" + contextName + "&Table=" + tableName + "&Field=" + columnName + "&Record=" + recordID + "\"/>";
}
else
{
content = "<IMG alt =\"" + title + "\" src =" + "\"../Shared/ExportFieldValue.aspx?Table=" + tableName + "&Field=" + columnName + "&Record=" + recordID + "\"/>";
}
object[] returnValue = new object[6];
returnValue[0] = title;
returnValue[1] = content;
returnValue[2] = persist;
returnValue[3] = popupWindowWidth;
returnValue[4] = popupWindowHeight;
returnValue[5] = popupWindowScrollBar;
return returnValue;
}
public void SetChartControl_Base(string chartCtrlName)
{
}
public void SaveData_Base()
{
this.RequisitionRecordControl.SaveData();
}
protected void SaveControlsToSession_Base()
{
base.SaveControlsToSession();
}
protected void ClearControlsFromSession_Base()
{
base.ClearControlsFromSession();
}
protected void LoadViewState_Base(object savedState)
{
base.LoadViewState(savedState);
}
protected object SaveViewState_Base()
{
return base.SaveViewState();
}
public void PreInit_Base()
{
}
public void Page_PreRender_Base(object sender, System.EventArgs e)
{
}
public void LoadData_Base()
{
try {
if ((!this.IsPostBack) || ( this.Request["__EVENTTARGET"] == "ChildWindowPostBack")) {
DbUtils.StartTransaction();
}
this.DataBind();
this.RequisitionRecordControl.LoadData();
this.RequisitionRecordControl.DataBind();
System.Web.UI.MasterPage pageMaster = this.Master;
if (!(pageMaster == null)) {
IMenuComponent menuComponent = ((IMenuComponent)(this.Master.FindControl("_MenuV")));
if (!(menuComponent == null)) {
menuComponent.HiliteSettings = "RequisitionMenuItem";
}
}
} catch (Exception ex) {
BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(this, "Page_Load_Error_Message", ex.Message);
} finally {
if ((!this.IsPostBack) || ( this.Request["__EVENTTARGET"] == "ChildWindowPostBack")) {
DbUtils.EndTransaction();
}
}
}
public BaseClasses.Data.DataSource.EvaluateFormulaDelegate EvaluateFormulaDelegate;
public string EvaluateFormula_Base(string formula, BaseClasses.Data.BaseRecord dataSourceForEvaluate, string format, System.Collections.Generic.IDictionary<string,> variables, bool includeDS)
{
FormulaEvaluator e = new FormulaEvaluator();
if (variables != null)
{
System.Collections.Generic.IEnumerator<system.collections.generic.keyvaluepair><string,>> enumerator = variables.GetEnumerator();
while (enumerator.MoveNext())
{
e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value);
}
}
if (includeDS)
{
}
e.CallingControl = this;
e.DataSource = dataSourceForEvaluate;
e.CallingControl = this;
object resultObj = e.Evaluate(formula);
if (resultObj == null)
return "";
if ( !string.IsNullOrEmpty(format) && (string.IsNullOrEmpty(formula) || formula.IndexOf("Format(") < 0) )
{
return FormulaUtils.Format(resultObj, format);
}
else
{
return resultObj.ToString();
}
}
public string EvaluateFormula(string formula, BaseClasses.Data.BaseRecord dataSourceForEvaluate, string format, System.Collections.Generic.IDictionary<string,> variables)
{
return EvaluateFormula(formula, dataSourceForEvaluate, format, variables, true);
}
private string EvaluateFormula(string formula, BaseClasses.Data.BaseRecord dataSourceForEvaluate)
{
return EvaluateFormula(formula, dataSourceForEvaluate, null, null, true);
}
public string EvaluateFormula(string formula, bool includeDS)
{
return EvaluateFormula(formula, null, null, null, includeDS);
}
public string EvaluateFormula(string formula)
{
return EvaluateFormula(formula, null, null, null, true);
}
public void CancelButton_Click_Base(object sender, EventArgs args)
{
bool shouldRedirect = true;
string TargetKey = null;
string DFKA = TargetKey;
string id = DFKA;
string value = id;
try {
TargetKey = this.Page.Request.QueryString["Target"];
if (TargetKey != null){
shouldRedirect = false;
}
} catch (Exception ex) {
shouldRedirect = false;
this.ErrorOnPage = true;
BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(this, "BUTTON_CLICK_MESSAGE", ex.Message);
} finally {
}
if (shouldRedirect) {
this.ShouldSaveControlsToSession = true;
this.RedirectBack();
}
else if (TargetKey != null && !shouldRedirect){
this.ShouldSaveControlsToSession = true ;
this.CloseWindow(true);
}
}
public void SaveAndNewButton_Click_Base(object sender, EventArgs args)
{
try {
DbUtils.StartTransaction();
if (!this.IsPageRefresh)
{
this.SaveData();
}
this.CommitTransaction(sender);
} catch (Exception ex) {
this.RollBackTransaction(sender);
this.ErrorOnPage = true;
BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(this, "BUTTON_CLICK_MESSAGE", ex.Message);
} finally {
DbUtils.EndTransaction();
}
}
public void SaveButton_Click_Base(object sender, EventArgs args)
{
bool shouldRedirect = true;
string TargetKey = null;
string DFKA = TargetKey;
string id = DFKA;
string value = id;
try {
DbUtils.StartTransaction();
if (!this.IsPageRefresh)
{
this.SaveData();
}
this.CommitTransaction(sender);
TargetKey = this.Page.Request.QueryString["Target"];
if (TargetKey != null)
{
DFKA = NetUtils.GetUrlParam(this, "DFKA", false);
if (this.RequisitionRecordControl != null && this.RequisitionRecordControl.DataSource != null){
id = this.RequisitionRecordControl.DataSource.RefNo.ToString();
if (!String.IsNullOrEmpty(DFKA))
{
if (DFKA.Trim().StartsWith("="))
{
System.Collections.Generic.IDictionary<string,> variables = new System.Collections.Generic.Dictionary<string,>();
variables.Add(this.RequisitionRecordControl.DataSource.TableAccess.TableDefinition.TableCodeName, this.RequisitionRecordControl.DataSource);
value = EvaluateFormula(DFKA, this.RequisitionRecordControl.DataSource, null,variables);
}
else
{
value = this.RequisitionRecordControl.DataSource.GetValue(this.RequisitionRecordControl.DataSource.TableAccess.TableDefinition.ColumnList.GetByAnyName(DFKA)).ToString();
}
}
if(value == null){
value = id;
}
string formula = this.Page.Request.QueryString["Formula"];
if (formula != null && formula != "")
{
System.Collections.Generic.IDictionary<string,> variables = new System.Collections.Generic.Dictionary<string,>();
variables.Add(this.RequisitionRecordControl.DataSource.TableAccess.TableDefinition.TableCodeName, this.RequisitionRecordControl.DataSource);
value = EvaluateFormula(formula, this.RequisitionRecordControl.DataSource, null,variables);
}
BaseClasses.Utils.MiscUtils.RegisterAddButtonScript(this, TargetKey, id, value);
}
shouldRedirect = false;
}
} catch (Exception ex) {
this.RollBackTransaction(sender);
shouldRedirect = false;
this.ErrorOnPage = true;
BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(this, "BUTTON_CLICK_MESSAGE", ex.Message);
} finally {
DbUtils.EndTransaction();
}
if (shouldRedirect) {
this.ShouldSaveControlsToSession = true;
this.RedirectBack();
}
else if (TargetKey != null && !shouldRedirect){
this.ShouldSaveControlsToSession = true ;
this.CloseWindow(true);
}
}
#endregion
}
}
Now for my problems:
1. The AddRequisition.aspx/AddPayment.aspx: both have a reference number. I wanted it to be unique number(but not a primary key). I wanted it to be in the following format: DDMMYY(TransactionNo)(UserID) eg: 24061101PK. I have tried and tried but have not been able to sort it out.
2. The AmountINWords gets the value from Amount. It converts the Amount into words. Thats not all. It picks what currncy was picked in the CurrencyPaidIn and pust the respective currency inside. eg. 123.45 USD becomes One Hundred and twenty three dollars and forty five cents. I tried using queries but as you will see that went all wrong.
Those are the only two things that I cant seem to get my head around. I do know that there are some things that are not conventional ASP.NET and some text boxes are not the right size. I was thinking of sorting out those after I get those two fixed because they are simple to do.
I really need some help with this application please. If someone can just have a look at the code and add a few things here and there.
Thanks in advance.
Faz