Hi,
First time using RadTabStrip. I have 7 Tabs. In tab index 0 I only display data in Literal controls, but in my second tab I populate a form for updating the record.
In my RadTabStrip I have OnLoad="rtsOrganisation_Load" which calls another method LoadTabData which uses a switch to determine what to load for the selected Tab. Therefore I am not loading the data for all tabs each time someone clicks a tab in my page.
The form is populated, however when I click my button to save the record, the new form data never gets passed to my save method, therefore my record gets updated with the original data only?
I'm wondering if the problem is in my LoadTabData method being called with every load of the RadTabStrip? I guess I'm just basically lost..
Please help...
First time using RadTabStrip. I have 7 Tabs. In tab index 0 I only display data in Literal controls, but in my second tab I populate a form for updating the record.
In my RadTabStrip I have OnLoad="rtsOrganisation_Load" which calls another method LoadTabData which uses a switch to determine what to load for the selected Tab. Therefore I am not loading the data for all tabs each time someone clicks a tab in my page.
The form is populated, however when I click my button to save the record, the new form data never gets passed to my save method, therefore my record gets updated with the original data only?
I'm wondering if the problem is in my LoadTabData method being called with every load of the RadTabStrip? I guess I'm just basically lost..
Please help...
<
div
class
=
"adminrc"
>
<
asp:Literal
ID
=
"litFeedback"
runat
=
"server"
Visible
=
"false"
/>
<
fieldset
>
<
legend
>View Organisation - <
span
><
asp:Literal
ID
=
"litTabTitleCurrent"
runat
=
"server"
Text
=
"Manage Organisation"
/></
span
></
legend
>
<
asp:HiddenField
ID
=
"hidPreviousTabHidden"
runat
=
"server"
Value
=
""
/>
<
script
type
=
"text/javascript"
>
function OnSelecting(sender, args) {
document.getElementById("<%= hidPreviousTabHidden.ClientID%>").value = sender.get_selectedTab().get_value(); // SelectedTab.Text;
}
</
script
>
<
telerik:RadTabStrip
ID
=
"rtsOrganisation"
runat
=
"server"
MultiPageID
=
"rmpOrganisation"
Skin
=
"Sunset"
SelectedIndex
=
"0"
AutoPostBack
=
"true"
OnTabClick
=
"rtsOrganisation_TabClick"
OnClientTabSelecting
=
"OnSelecting"
OnLoad
=
"rtsOrganisation_Load"
>
<
Tabs
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Company Details"
PageViewID
=
"rpvCompanyDetails"
Value
=
"CompanyDetails"
/>
<
telerik:RadTab
runat
=
"server"
Text
=
"Manage Company"
PageViewID
=
"rpvManageCompany"
Value
=
"ManageCompany"
/>
<
telerik:RadTab
runat
=
"server"
Text
=
"Manage Members"
PageViewID
=
"rpvManageMembers"
Value
=
"ManageMembers"
/>
<
telerik:RadTab
runat
=
"server"
Text
=
"Manage Package"
PageViewID
=
"rpvManagePackage"
Value
=
"ManagePackage"
/>
<
telerik:RadTab
runat
=
"server"
Text
=
"Manage Credits"
PageViewID
=
"rpvManageCredits"
Value
=
"ManageCredits"
/>
<
telerik:RadTab
runat
=
"server"
Text
=
"Purchase History"
PageViewID
=
"rpvPurchaseHistory"
Value
=
"PurchaseHistory"
/>
<
telerik:RadTab
runat
=
"server"
Text
=
"Notes"
PageViewID
=
"rpvNotes"
Value
=
"Notes"
/>
</
Tabs
>
</
telerik:RadTabStrip
>
<
telerik:RadMultiPage
ID
=
"rmpOrganisation"
runat
=
"server"
SelectedIndex
=
"0"
>
<%--
*****************************************************************************
*****************************************************************************
TAB - COMPANY DETAIL DISPLAY
*****************************************************************************
*****************************************************************************
--%>
<
telerik:RadPageView
ID
=
"rpvCompanyDetails"
runat
=
"server"
>
<
ol
>
<
li
>
<
label
><
asp:HyperLink
ID
=
"HyperLink1"
runat
=
"server"
Text
=
"« Organisation list"
NavigateUrl
=
"default.aspx"
/></
label
>
</
li
>
<
li
class
=
"bar"
>
<
h3
>Company Information</
h3
>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblInfoName"
runat
=
"server"
Text
=
"Company Name:"
AssociatedControlID
=
"litName"
/>
<
asp:Literal
ID
=
"litName"
runat
=
"server"
/>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblInfoExpiryDate"
runat
=
"server"
Text
=
"ExpiryDate:"
AssociatedControlID
=
"litExpiryDate"
/>
<
asp:Literal
ID
=
"litExpiryDate"
runat
=
"server"
/>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblInfoAccessType"
runat
=
"server"
Text
=
"Access Type:"
AssociatedControlID
=
"litAccessType"
/>
<
asp:Literal
ID
=
"litAccessType"
runat
=
"server"
/>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblInfoPackage"
runat
=
"server"
Text
=
"Access Type:"
AssociatedControlID
=
"litProductPackage"
/>
<
asp:Literal
ID
=
"litProductPackage"
runat
=
"server"
/>
</
li
>
<
li
class
=
"bar"
>
<
h3
>Contact</
h3
>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblInfoContactName"
runat
=
"server"
Text
=
"Contact Name:"
AssociatedControlID
=
"litContactName"
/>
<
asp:Literal
ID
=
"litContactName"
runat
=
"server"
/>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblInfoContactTitle"
runat
=
"server"
Text
=
"Position:"
AssociatedControlID
=
"litContactTitle"
/>
<
asp:Literal
ID
=
"litContactTitle"
runat
=
"server"
/>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblInfoPhone"
runat
=
"server"
Text
=
"Phone:"
AssociatedControlID
=
"litPhone"
/>
<
asp:Literal
ID
=
"litPhone"
runat
=
"server"
/>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblInfoFax"
runat
=
"server"
Text
=
"Fax:"
AssociatedControlID
=
"litFax"
/>
<
asp:Literal
ID
=
"litFax"
runat
=
"server"
/>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblInfoEmail"
runat
=
"server"
Text
=
"Email:"
AssociatedControlID
=
"hlEmail"
/>
<
asp:HyperLink
ID
=
"hlEmail"
runat
=
"server"
Text
=
""
NavigateUrl
=
""
/>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblInfoURL"
runat
=
"server"
Text
=
"URL:"
AssociatedControlID
=
"hlURL"
/>
<
asp:HyperLink
ID
=
"hlURL"
runat
=
"server"
Text
=
""
NavigateUrl
=
""
/>
</
li
>
</
ol
>
</
telerik:RadPageView
>
<%--
*****************************************************************************
*****************************************************************************
TAB - MANAGE COMPANY (FORM)
*****************************************************************************
*****************************************************************************
--%>
<
telerik:RadPageView
ID
=
"rpvManageCompany"
runat
=
"server"
>
<
ol
>
<
li
>
<
label
><
asp:HyperLink
ID
=
"lnkBack1"
runat
=
"server"
Text
=
"« Organisation list"
NavigateUrl
=
"default.aspx"
/></
label
>
</
li
>
<
li
class
=
"bar"
>
<
h3
>1. Basic Information</
h3
>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblPublications"
runat
=
"server"
Text="Publications: <span
class
=
required
title
=
Required
>*</
span
>" AssociatedControlID="psPublicationSelector" />
<
ah:PublicationSelector
ID
=
"psPublicationSelector"
runat
=
"server"
AllowMultipleSelections
=
"false"
PropertyName
=
"Publication"
AutoPostBackSingle
=
"true"
/>
<
asp:RequiredFieldValidator
ID
=
"rfvPublicationId"
runat
=
"server"
ControlToValidate
=
"psPublicationSelector"
Text
=
"Pick a Publication"
ValidationGroup
=
"ValidatePage"
SetFocusOnError
=
"true"
></
asp:RequiredFieldValidator
>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblArtsHubStaffSelector"
runat
=
"server"
Text
=
"Staff/Sales Person"
AssociatedControlID
=
"asArtsHubStaffSelector"
/>
<
ah:ArtsHubStaffSelector
ID
=
"asArtsHubStaffSelector"
runat
=
"server"
InsertEmpty
=
" --Sales Person"
/>
</
li
>
<
li
class
=
"bar"
>
<
h3
>2. Package Details</
h3
>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblProductPackageTemplateSelector"
runat
=
"server"
Text
=
"Package Template:"
AssociatedControlID
=
"ptProductPackageTemplateSelector"
/>
<
ah:ProductPackageTemplateSelector
ID
=
"ptProductPackageTemplateSelector"
runat
=
"server"
PackageLegacyStatus
=
"No"
PublicationId
=
"AU"
/>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblOrgAccessTypeSelector"
runat
=
"server"
Text
=
"Org AccessType:"
AssociatedControlID
=
"oaOrgAccessTypeSelector"
/>
<
ah:OrgAccessTypeSelector
ID
=
"oaOrgAccessTypeSelector"
runat
=
"server"
/>
<
asp:Label
ID
=
"lblCanViewJobs"
runat
=
"server"
Text
=
"Licence can view jobs"
/>
<
asp:CheckBox
ID
=
"cbCanViewJobs"
runat
=
"server"
/> <
span
>(Licence access type only)</
span
>
</
li
>
<
li
class
=
"bar"
>
<
h3
>3. Company Details</
h3
>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblName"
runat
=
"server"
Text="Company Name: <span
class
=
required
title
=
Required
>*</
span
>" AssociatedControlID="tbName" />
<
asp:TextBox
ID
=
"tbName"
runat
=
"server"
Columns
=
"50"
ValidationGroup
=
"ValidatePage"
MaxLength
=
"75"
/>
<
asp:Label
ID
=
"lblIsFeatured"
runat
=
"server"
Text
=
"Featured Org"
/>
<
asp:CheckBox
ID
=
"cbIsFeatured"
runat
=
"server"
/> <
span
>(Used for Company of the week)</
span
>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblExpiryDate"
runat
=
"server"
Text
=
"Expiry Date:"
AssociatedControlID
=
"rdpExpiryDate"
/>
<
telerik:RadDatePicker
ID
=
"rdpExpiryDate"
runat
=
"server"
/>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblABN"
runat
=
"server"
Text
=
"ABN"
AssociatedControlID
=
"tbABN"
/>
<
asp:TextBox
ID
=
"tbABN"
runat
=
"server"
Text
=
""
/>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblContactName"
runat
=
"server"
Text="Contact/Billing Name: <span
class
=
required
title
=
Required
>*</
span
>" AssociatedControlID="tbContactName" />
<
asp:TextBox
ID
=
"tbContactName"
runat
=
"server"
Columns
=
"50"
ValidationGroup
=
"ValidatePage"
MaxLength
=
"75"
/>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblContactTitle"
runat
=
"server"
Text="Contact Title/Position: <span
class
=
required
title
=
Required
>*</
span
>" AssociatedControlID="tbContactTitle" />
<
asp:TextBox
ID
=
"tbContactTitle"
runat
=
"server"
Columns
=
"50"
ValidationGroup
=
"ValidatePage"
MaxLength
=
"75"
/>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblPhone"
runat
=
"server"
Text="Phone: <span
class
=
required
title
=
Required
>*</
span
>" AssociatedControlID="tbPhone" />
<
asp:TextBox
ID
=
"tbPhone"
runat
=
"server"
Columns
=
"50"
ValidationGroup
=
"ValidatePage"
MaxLength
=
"50"
/>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblFax"
runat
=
"server"
Text
=
"Fax:"
AssociatedControlID
=
"tbFax"
/>
<
asp:TextBox
ID
=
"tbFax"
runat
=
"server"
Columns
=
"50"
MaxLength
=
"50"
/>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblEmail"
runat
=
"server"
Text="Email: <span
class
=
required
title
=
Required
>*</
span
>" AssociatedControlID="tbEmail" />
<
asp:TextBox
ID
=
"tbEmail"
runat
=
"server"
Columns
=
"50"
ValidationGroup
=
"ValidatePage"
MaxLength
=
"75"
/>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblURL"
runat
=
"server"
Text
=
"Companies URL:"
AssociatedControlID
=
"tbURL"
/>
<
asp:TextBox
ID
=
"tbURL"
runat
=
"server"
Columns
=
"50"
ValidationGroup
=
"ValidatePage"
MaxLength
=
"75"
/>
<
asp:CheckBox
ID
=
"cbListURLOnPublic"
runat
=
"server"
/> <
span
>(List URL On Public)</
span
>
<%--<
asp:RegularExpressionValidator
ID
=
"revURL"
runat
=
"server"
ControlToValidate
=
"tbURL"
ErrorMessage
=
"Enter a Valid Company URL"
Display
=
"Dynamic"
ValidationExpression
=
"^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]*)?$"
SetFocusOnError
=
"true"
ValidationGroup
=
"links"
></
asp:RegularExpressionValidator
>--%>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblOrgSize"
runat
=
"server"
Text
=
"Organisation size"
AssociatedControlID
=
"osOrganisationSizeSelector"
/>
<
ah:OrganisationSizeSelector
ID
=
"osOrganisationSizeSelector"
runat
=
"server"
/>
</
li
>
<
li
class
=
"bar"
>
<
h3
>4. Company Address</
h3
>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblAddress1"
runat
=
"server"
Text="Address1: <span
class
=
required
title
=
Required
>*</
span
>" AssociatedControlID="tbAddress1" />
<
asp:TextBox
ID
=
"tbAddress1"
runat
=
"server"
Columns
=
"50"
ValidationGroup
=
"ValidatePage"
MaxLength
=
"75"
/>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblAddress2"
runat
=
"server"
Text
=
"Address2:"
AssociatedControlID
=
"tbAddress2"
/>
<
asp:TextBox
ID
=
"tbAddress2"
runat
=
"server"
Text
=
""
MaxLength
=
"75"
/>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblSuburb"
runat
=
"server"
Text="Suburb: <span
class
=
required
title
=
Required
>*</
span
>" AssociatedControlID="tbSuburb" />
<
asp:TextBox
ID
=
"tbSuburb"
runat
=
"server"
Columns
=
"50"
ValidationGroup
=
"ValidatePage"
MaxLength
=
"50"
/>
</
li
>
<
li
class
=
"blockFixSelector"
>
<
asp:Label
ID
=
"lblRegion"
runat
=
"server"
Text
=
"Region:"
AssociatedControlID
=
"csCountrySelector"
/>
<
ah:CountrySelector
ID
=
"csCountrySelector"
runat
=
"server"
ShowSubRegions
=
"false"
MaxHeight
=
"100"
/>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblPostcode"
runat
=
"server"
Text="Postcode: <span
class
=
required
title
=
Required
>*</
span
>" AssociatedControlID="tbPostcode" />
<
asp:TextBox
ID
=
"tbPostcode"
runat
=
"server"
Columns
=
"50"
ValidationGroup
=
"ValidatePage"
MaxLength
=
"10"
/>
</
li
>
<
li
class
=
"bar"
>
<
h3
>5. Notes</
h3
>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblNotes"
runat
=
"server"
Text
=
"Notes:"
AssociatedControlID
=
"reNotes"
/>
<
telerik:RadTextBox
ID
=
"reNotes"
TextMode
=
"MultiLine"
runat
=
"server"
Rows
=
"4"
Columns
=
"50"
MaxLength
=
"250"
></
telerik:RadTextBox
>
</
li
>
<
li
class
=
"bar"
>
<
h3
>6. Invoice Details</
h3
>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblInvoiceDate"
runat
=
"server"
Text
=
"Invoice Date:"
AssociatedControlID
=
"rdpInvoiceDate"
/>
<
telerik:RadDatePicker
ID
=
"rdpInvoiceDate"
runat
=
"server"
Enabled
=
"false"
/>
</
li
>
<
li
>
<
asp:Label
ID
=
"lblInvoiceAmount"
runat
=
"server"
Text
=
"Invoice Amount:"
AssociatedControlID
=
"tbInvoiceAmount"
/>
<
asp:TextBox
ID
=
"tbInvoiceAmount"
runat
=
"server"
Columns
=
"50"
Enabled
=
"false"
/>
<
asp:Label
ID
=
"lblInvoicePaid"
runat
=
"server"
Text
=
"Paid:"
AssociatedControlID
=
"cbInvoicePaid"
/>
<
asp:CheckBox
ID
=
"cbInvoicePaid"
runat
=
"server"
/>
</
li
>
<%--Buttons --%>
<
li
class
=
"bar"
>
<
h3
> </
h3
>
</
li
>
<
li
>
<
label
> </
label
>
<
asp:Button
ID
=
"btnSave"
runat
=
"server"
Text
=
"Save Organisation"
OnClick
=
"btnSaveOrgDetails_Click"
ValidationGroup
=
"ValidatePage"
TabIndex
=
"15"
/>
<
label
> </
label
>
<
asp:Button
ID
=
"btnExit"
runat
=
"server"
Text
=
"Exit without Saving"
OnClick
=
"btnExit_Click"
CausesValidation
=
"false"
/>
</
li
>
</
ol
>
<
ajaxToolkit:ConfirmButtonExtender
ID
=
"ConfirmButtonExtender1"
runat
=
"server"
ConfirmText
=
"Proceed with Saving Organisation?"
TargetControlID
=
"btnSave"
/>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
/>
<
telerik:RadInputManager
ID
=
"RadInputManager1"
runat
=
"server"
>
<
telerik:TextBoxSetting
BehaviorID
=
"TextBoxBehavior1"
>
<
Validation
IsRequired
=
"true"
ValidationGroup
=
"ValidatePage"
/>
<
TargetControls
>
<
telerik:TargetInput
ControlID
=
"tbName"
/>
<
telerik:TargetInput
ControlID
=
"tbContactName"
/>
<
telerik:TargetInput
ControlID
=
"tbContactTitle"
/>
<
telerik:TargetInput
ControlID
=
"tbPhone"
/>
<
telerik:TargetInput
ControlID
=
"tbEmail"
/>
<
telerik:TargetInput
ControlID
=
"tbAddress1"
/>
<
telerik:TargetInput
ControlID
=
"tbSuburb"
/>
<
telerik:TargetInput
ControlID
=
"tbPostcode"
/>
</
TargetControls
>
</
telerik:TextBoxSetting
>
<
telerik:RegExpTextBoxSetting
BehaviorID
=
"RegExpTextBoxSetting1"
EmptyMessage
=
"Full URL including 'http://' required"
ValidationExpression
=
"^http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$"
>
<
Validation
IsRequired
=
"false"
ValidationGroup
=
"ValidatePage"
/>
<
TargetControls
>
<
telerik:TargetInput
ControlID
=
"tbUrl"
/>
</
TargetControls
>
</
telerik:RegExpTextBoxSetting
>
</
telerik:RadInputManager
>
</
telerik:RadPageView
>
<%--
*****************************************************************************
*****************************************************************************
TAB - MANAGE MEMBERS
*****************************************************************************
*****************************************************************************
--%>
<
telerik:RadPageView
ID
=
"rpvManageMembers"
runat
=
"server"
>
<
p
>TAB 3 Members</
p
>
<
asp:Literal
ID
=
"testValue"
runat
=
"server"
Text
=
"Default stuff here"
/>
</
telerik:RadPageView
>
<%--
*****************************************************************************
*****************************************************************************
TAB - MANAGE PACKAGE
*****************************************************************************
*****************************************************************************
--%>
<
telerik:RadPageView
ID
=
"rpvManagePackage"
runat
=
"server"
>
<
p
>TAB 4 "Manage Package</
p
>
</
telerik:RadPageView
>
</
telerik:RadPageView
>
<%--
*****************************************************************************
*****************************************************************************
TAB - MANAGE CREDITS
*****************************************************************************
*****************************************************************************
--%>
<
telerik:RadPageView
ID
=
"rpvManageCredits"
runat
=
"server"
>
<
p
>TAB 5 Manage Credits</
p
>
</
telerik:RadPageView
>
</
telerik:RadPageView
>
<%--
*****************************************************************************
*****************************************************************************
TAB - PURCHASE HISTORY
*****************************************************************************
*****************************************************************************
--%>
<
telerik:RadPageView
ID
=
"rpvPurchaseHistory"
runat
=
"server"
>
<
p
>TAB 6 Purchase History</
p
>
</
telerik:RadPageView
>
</
telerik:RadPageView
>
<%--
*****************************************************************************
*****************************************************************************
TAB - NOTES
*****************************************************************************
*****************************************************************************
--%>
<
telerik:RadPageView
ID
=
"rpvNotes"
runat
=
"server"
>
<
p
>TAB 7 Notes</
p
>
</
telerik:RadPageView
>
</
telerik:RadMultiPage
>
</
fieldset
>
</
div
>
public
partial
class
admin_membership_organisation_view : System.Web.UI.Page
{
RadTab lastClickedTab =
null
;
protected
override
void
OnPreRenderComplete(EventArgs e)
{
base
.OnPreRenderComplete(e);
if
(!Page.IsPostBack)
{
Utilities.FeedBackMessage(litFeedback);
}
}
protected
void
Page_PreLoad(
object
sender, EventArgs e)
{
//if (!Page.IsPostBack)
//{
if
(Request.Form[
"__EVENTTARGET"
] == rtsOrganisation.UniqueID)
{
//locate the selected tab by using the value of the hidden field
//The code below will be executed only if the postback is fired by the tabstrip
//lastClickedTab = rtsOrganisation.FindTabByText(hidPreviousTabHidden.Value);
////LoadTabData(rmpOrganisation.SelectedIndex, rtsOrganisation.SelectedTab.Text.ToString());
}
//}
}
protected
void
rtsOrganisation_Load(
object
sender, EventArgs e)
{
//What was the previous tab?
lastClickedTab = rtsOrganisation.FindTabByText(hidPreviousTabHidden.Value);
//if (!Page.IsPostBack)
//{
LoadTabData(rtsOrganisation.SelectedIndex, rtsOrganisation.SelectedTab.Text.ToString());
//}
}
protected
void
rtsOrganisation_TabClick(
object
sender, RadTabStripEventArgs e)
{
////Telerik.Web.UI.RadTab TabClicked = e.Tab;
//LoadTabData(e, e.Tab.Text.ToString());
litFeedback.Text =
""
;
litFeedback.Visible =
false
;
}
protected
void
LoadTabData(RadTabStripEventArgs e,
string
tabName)
{
LoadTabData(e.Tab.SelectedIndex, tabName);
}
protected
void
LoadTabData(
int
selectedTabIndex,
string
tabName)
{
litTabTitleCurrent.Text = tabName;
//Previous clicked tab was " + lastClickedTab.Text;
switch
(selectedTabIndex)
{
case
0:
//do stuff
BindCompanyDetails(Organisation.GetOrgId);
break
;
case
1:
//do stuff
BindManageCompany(Organisation.GetOrgId);
break
;
case
2:
//do stuff
testValue.Text =
"See it loaded!!"
;
break
;
case
3:
//do stuff
break
;
case
4:
//do stuff
break
;
case
5:
//do other stuff
break
;
}
}
protected
void
btnExit_Click(
object
sender, EventArgs e)
{
Utilities.FeedbackWithRedirect(
"default.aspx"
,
"Exited Manage/View Org without Saving!"
, ConfigGlobal.FeedbackStatus.Information);
}
#region TAB - View Company Details
private
void
BindCompanyDetails(
int
orgId)
{
Organisation record = Organisation.GetOrganisation_Cacheless(orgId);
BindCompanyDetails(record);
}
private
void
BindCompanyDetails(Organisation record)
{
if
(record !=
null
)
{
//Organisation Basic deets #################################################
litName.Text = record.Name;
litExpiryDate.Text = Utilities.NiceDate(record.ExpiryDate);
litAccessType.Text = record.AccessType;
litProductPackage.Text = record.CurrentProductPackageTemplate.ProductPackageTemplateName;
litContactName.Text = record.ContactName;
litContactTitle.Text = record.ContactTitle;
litPhone.Text = record.Phone;
litFax.Text = record.Fax;
hlEmail.Text = record.Email;
hlEmail.NavigateUrl =
"mailto:"
+ record.Email;
hlURL.Text = record.URL;
hlURL.NavigateUrl = record.URL;
hlURL.Target =
"_blank"
;
}
}
#endregion
#region TAB - Manage Company Details
/// <summary>
///
/// </summary>
protected
void
btnSaveOrgDetails_Click(
object
sender, EventArgs e)
{
Page.Validate(
"ValidatePage"
);
if
(Page.IsValid)
{
litFeedback.Visible =
true
;
if
(psPublicationSelector.SelectedPubId == 0)
{
litFeedback.Text =
"<p class=\"warn\">You must select a Publication and a Member for the Listing and the Purchase.</p>"
;
}
else
{
Organisation record = Organisation.GetOrganisation(Organisation.GetOrgId);
//Collect data from form
record = BuildOrgDetailsFromForm(record);
if
(record.Save())
{
//BindJob(Job.GetJobId);
Utilities.FeedbackWithRedirect(
"organisation-view.aspx?OrgId="
+ record.Id.ToString(),
"Company #"
+ record.Id +
" has been updated successfully."
, ConfigGlobal.FeedbackStatus.Success);
}
else
{
litFeedback.Text =
"<p class=\"failure\">A error has occured, please try updating this Job Advertisement again.</p>"
;
}
}
}
else
{
BLL.Emailing.Emailing.EmailBug(
"NOT VALID? Name="
+ tbName.Text.Trim(),
""
);
}
}
/// <summary>
/// Collect the form data into the record for saving
/// </summary>
protected
Organisation BuildOrgDetailsFromForm(Organisation record)
{
//Organisation Basic deets #################################################
record.Name = tbName.Text.Trim();
record.PublicationId = Convert.ToByte(psPublicationSelector.SelectedPubId);
record.CurrentPackageId = ptProductPackageTemplateSelector.SelectedProductPackageTemplate;
record.AccessType = oaOrgAccessTypeSelector.SelectedOrgAccessType;
record.CanViewJobs = cbCanViewJobs.Checked;
record.AdminUserId = asArtsHubStaffSelector.SelectedArtsHubStaff;
record.OrgSizeId = osOrganisationSizeSelector.SelectedOrganisationSize;
//Contact Deets ###########################################
record.ABN = tbABN.Text.Trim();
record.ContactName = tbContactName.Text.Trim();
record.ContactTitle = tbContactTitle.Text.Trim();
record.Phone = tbPhone.Text.Trim();
record.Fax = tbFax.Text.Trim();
record.Email = tbEmail.Text.Trim();
record.URL = tbURL.Text.Trim();
record.ListURLOnPublic = cbListURLOnPublic.Checked;
//Contact Deets ###########################################
record.Address1 = tbAddress1.Text.Trim();
record.Address2 = tbAddress2.Text.Trim();
record.Suburb = tbSuburb.Text.Trim();
record.RegionId = csCountrySelector.selectedRegionId;
record.CountryCode = csCountrySelector.selectedCountryCode;
record.Postcode = tbPostcode.Text.Trim();
//Dates
record.ExpiryDate = (rdpExpiryDate.SelectedDate.HasValue) ? rdpExpiryDate.SelectedDate.Value : DateTime.MinValue;
record.InvoiceDate = (rdpInvoiceDate.SelectedDate.HasValue) ? rdpInvoiceDate.SelectedDate.Value : DateTime.MinValue;
record.InvoicePaid = cbInvoicePaid.Checked;
record.InvoiceAmount =
decimal
.Parse(tbInvoiceAmount.Text);
record.Notes = reNotes.Text.Trim();
record.IsFeaturedOrg = cbIsFeatured.Checked;
return
record;
}
private
void
BindManageCompany(
int
orgId)
{
Page.Form.DefaultButton = btnSave.UniqueID;
Organisation record = Organisation.GetOrganisation_Cacheless(orgId);
BindManageCompany(record);
}
private
void
BindManageCompany(Organisation record)
{
if
(record !=
null
)
{
//Organisation Basic deets #################################################
tbName.Text = record.Name;
psPublicationSelector.SelectedPubId = (
int
)record.PublicationId;
ptProductPackageTemplateSelector.SelectedProductPackageTemplate = record.CurrentPackageId;
oaOrgAccessTypeSelector.SelectedOrgAccessType = record.AccessType;
cbCanViewJobs.Checked = record.CanViewJobs;
asArtsHubStaffSelector.SelectedArtsHubStaff = record.AdminUserId;
osOrganisationSizeSelector.SelectedOrganisationSize = record.OrgSizeId;
//Contact Deets ###########################################
tbABN.Text = record.ABN;
tbContactName.Text = record.ContactName;
tbContactTitle.Text = record.ContactTitle;
tbPhone.Text = record.Phone;
tbFax.Text = record.Fax;
tbEmail.Text = record.Email;
tbURL.Text = record.URL;
cbListURLOnPublic.Checked = record.ListURLOnPublic;
//Contact Deets ###########################################
tbAddress1.Text = record.Address1;
tbAddress2.Text = record.Address2;
tbSuburb.Text = record.Suburb;
csCountrySelector.selectedRegionId = record.RegionId;
csCountrySelector.selectedCountryCode = record.CountryCode;
tbPostcode.Text = record.Postcode;
//Dates
rdpExpiryDate.SelectedDate = record.ExpiryDate;
reNotes.Text = record.Notes;
cbIsFeatured.Checked = record.IsFeaturedOrg;
rdpInvoiceDate.SelectedDate = record.InvoiceDate;
tbInvoiceAmount.Text = record.InvoiceAmount.ToString();
cbInvoicePaid.Checked = record.InvoicePaid;
}
}
#endregion
}