Hi,i am usin jquery tab and in that tabs one of tab is having the gridview that gridview having the paging,while trying to change the paging,it loads whole page..here is my source and code please help me...
thank u in adv........
<%@ Control Language="C#" AutoEventWireup="true" Inherits="TI.Membership.Web.members.controls.BusinessMembershipInfo"
CodeBehind="BusinessMembershipInfo.ascx.cs" %>
<%@ Import Namespace="Vascape.DataLayer" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register TagName="SubscriptionInfo" TagPrefix="uc1" Src="~/TIControls/SubscriptionInfo.ascx" %>
<div class="userInfoWrap" style="height: 900px">
<%----%>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<contenttemplate>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css"
rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<%----%>
<script type="text/javascript">
$(function () {
$("#myTabs").tabs({ fx: { opacity: "toggle"} });
});
</script>
</head>
<body>
<div class="Container">
<div class="TabPanelHeaderText" id="myTabs" style="width: 900px; height: 40px; font-size: small;">
<div class="ContentTemplate">
<ul class="tabs">
<li><a href="#ChangePassword">ChangePassword</a></li>
<li><a href="#ChangeEmail">ChangeEmail</a></li>
<li><a href="#EditProfile">EditProfile</a></li>
<li><a href="#Business">Business</a></li>
<li><a href="#Notifications">Notifications</a></li>
</ul>
<uc1:SubscriptionInfo ID="ucSubscriptionInfo" runat="server" Font-Size="13px" CssClass="aTab1">
<%----%>
<%----%>
<div id="ChangePassword" class="tab_content">
<%----%>
<div class="contentTemplate" align="center">
<br />
<div class="formSectionTitle2" align="center" style="font-size: large">
PASSWORD DETAILS
</div>
<asp:ChangePassword ID="ChangePassword1" runat="server" EnableViewState="False" ContinueDestinationPageUrl="~/login.aspx">
<maildefinition bodyfilename="~/email_templates/change-password.htm" isbodyhtml="True">
Subject="Your password has been changed!">
</maildefinition>
</div>
<%----%>
</div>
<div id="ChangeEmail" class="tab_content">
<%----%>
<div class="contentTemplate" align="center">
<div class="formSectionTitle2" align="center" style="font-size: large">
USER DETAILS
</div>
<asp:DetailsView AutoGenerateRows="False" DataSourceID="ObjectDataSource1" ID="DetailsView1"
runat="server" OnItemUpdating="DetailsView1_ItemUpdating" CssClass="dv">
<fields>
<asp:BoundField DataField="UserName" HeaderText="UserName" ReadOnly="True" SortExpression="UserName">
<asp:TemplateField HeaderText="Email" SortExpression="Email">
<edititemtemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Email") %>'>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox1"
Display="Dynamic" ErrorMessage="Email only!" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
Display="Dynamic" ErrorMessage="Email is required!" SetFocusOnError="True">
</edititemtemplate>
<insertitemtemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Email") %>'>
</insertitemtemplate>
<itemtemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Email") %>'>
</itemtemplate>
<asp:BoundField DataField="CreationDate" HeaderText="Creation Date" SortExpression="CreationDate"
ReadOnly="True">
<asp:BoundField DataField="LastActivityDate" HeaderText="Last Activity Date" SortExpression="LastActivityDate"
ReadOnly="True">
<asp:CheckBoxField DataField="IsOnline" HeaderText="Online?" SortExpression="IsOnline"
ReadOnly="True">
<asp:CheckBoxField DataField="IsApproved" HeaderText="Approved?" SortExpression="IsApproved"
ReadOnly="True">
<asp:CheckBoxField DataField="IsLockedOut" HeaderText="Locked Out?" SortExpression="IsLockedOut"
ReadOnly="True">
<asp:BoundField DataField="PasswordQuestion" HeaderText="Password Question" ReadOnly="True"
SortExpression="PasswordQuestion">
<asp:BoundField DataField="LastLoginDate" HeaderText="Last Login Date" SortExpression="LastLoginDate"
ReadOnly="True">
<asp:BoundField DataField="LastLockoutDate" HeaderText="Last Lockout Date" ReadOnly="True"
SortExpression="LastLockoutDate">
<asp:BoundField DataField="LastPasswordChangedDate" HeaderText="Last Password Changed Date"
ReadOnly="True" SortExpression="LastPasswordChangedDate">
<asp:CommandField ButtonType="Button" ShowEditButton="True" EditText="Edit User Details">
<controlstyle font-size="11px" />
</fields>
<rowstyle cssclass="dvRowStyle" />
<fieldheaderstyle cssclass="dvFieldHeader" />
<HeaderStyle CssClass="dvHeader" />
<alternatingrowstyle cssclass="dvAlternateRowStyle" />
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DataObjectTypeName="System.Web.Security.MembershipUser"
SelectMethod="GetUser" TypeName="System.Web.Security.Membership">
<br />
<br />
<asp:Button ID="btnDeleteCurrentUser" runat="server" Text="Close and Delete my account"
OnClick="btnDeleteCurrentUser_Click" OnClientClick="return confirm('Are you sure? This action will delete all your information and is unrecoverable.');" />
<br />
<asp:Label ID="lblResult" runat="server" Visible="False" BackColor="Red" />
</div>
<%----%>
</div>
<div id="EditProfile" class="tab_content">
<%----%>
<div id="tabId" align="center" style="width: 960px; font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;<br mode=" hold=" /> text-align: left; padding-left: 20px">
<table align="center">
<div align="center" style="font-size: large">
<caption>
ABOUT YOU
<br />
</caption>
</div>
<caption>
<br />
<tr>
<td align="left" colspan="2">
<label for="txtFirstname">
First name</label><br />
<asp:TextBox ID="txtFirstName" runat="server" align="right" Width="400px" />
</td>
<td align="left" colspan="2">
<label for="txtLastname">
Last name</label><br />
<asp:TextBox ID="txtLastName" runat="server" Width="337px" />
</td>
</tr>
<tr>
<td align="left">
<label for="txtGender">
Gender</label>
</td>
<td align="left">
<asp:DropDownList ID="ddlGenders" runat="server" Width="200px">
<asp:ListItem Selected="True" Text="Please select one..." />
<asp:ListItem Text="Male" Value="M" />
<asp:ListItem Text="Female" Value="F" />
</td>
<td>
<label for="txtBirthdate">
Birth date</label>
</td>
<td align="left">
<asp:TextBox ID="txtBirthDate" runat="server" Width="200px">
</td>
<cc1:CalendarExtender ID="txtBirthDate_CalendarExtender" runat="server"
Enabled="True" TargetControlID="txtBirthDate">
<asp:CompareValidator ID="valBirthDateFormat" runat="server"
ControlToValidate="txtBirthDate" Display="Dynamic"
ErrorMessage="The format of the birth date is not valid."
Operator="DataTypeCheck" SetFocusOnError="True" Type="Date"
ValidationGroup="EditProfile">
<cc1:MaskedEditExtender ID="MaskedEditExtender1" runat="server"
CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder=""
CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder=""
CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True"
Mask="99/99/9999" MaskType="Date" TargetControlID="txtBirthDate" />
<cc1:MaskedEditValidator ID="MaskedEditValidator1" runat="server"
ControlExtender="MaskedEditExtender1" ControlToValidate="txtBirthDate"
Display="Dynamic" EmptyValueMessage="Date must be in correct format"
ErrorMessage="MaskedEditValidator1" InvalidValueMessage="This date is invalid"
TooltipMessage="Please enter a date" />
</tr>
<tr>
<td align="left">
<label for="txtOccupation">
Occupation</label>
</td>
<td>
<asp:DropDownList ID="ddlOccupations" runat="server" Width="200px">
<asp:ListItem Selected="True" Text="Please select one..." />
<asp:ListItem Text="Academic" />
<asp:ListItem Text="Accountant" />
<asp:ListItem Text="Actor" />
<asp:ListItem Text="Architect" />
<asp:ListItem Text="Artist" />
<asp:ListItem Text="Business Manager" />
<asp:ListItem Text="Carpenter" />
<asp:ListItem Text="Chief Executive" />
<asp:ListItem Text="Cinematographer" />
<asp:ListItem Text="Civil Servant" />
<asp:ListItem Text="Coach" />
<asp:ListItem Text="Composer" />
<asp:ListItem Text="Computer programmer" />
<asp:ListItem Text="Cook" />
<asp:ListItem Text="Counsellor" />
<asp:ListItem Text="Doctor" />
<asp:ListItem Text="Driver" />
<asp:ListItem Text="Economist" />
<asp:ListItem Text="Editor" />
<asp:ListItem Text="Electrician" />
<asp:ListItem Text="Engineer" />
<asp:ListItem Text="Executive Producer" />
<asp:ListItem Text="Fixer" />
<asp:ListItem Text="Graphic Designer" />
<asp:ListItem Text="Hairdresser" />
<asp:ListItem Text="Headhunter" />
<asp:ListItem Text="HR - Recruitment" />
<asp:ListItem Text="Information Officer" />
<asp:ListItem Text="IT Consultant" />
<asp:ListItem Text="Journalist" />
<asp:ListItem Text="Lawyer / Solicitor" />
<asp:ListItem Text="Lecturer" />
<asp:ListItem Text="Librarian" />
<asp:ListItem Text="Mechanic" />
<asp:ListItem Text="Model" />
<asp:ListItem Text="Musician" />
<asp:ListItem Text="Office Worker" />
<asp:ListItem Text="Performer" />
<asp:ListItem Text="Photographer" />
<asp:ListItem Text="Presenter" />
<asp:ListItem Text="Producer / Director" />
<asp:ListItem Text="Project Manager" />
<asp:ListItem Text="Researcher" />
<asp:ListItem Text="Salesman" />
<asp:ListItem Text="Social Worker" />
<asp:ListItem Text="Soldier" />
<asp:ListItem Text="Sportsperson" />
<asp:ListItem Text="Student" />
<asp:ListItem Text="Teacher" />
<asp:ListItem Text="Technical Crew" />
<asp:ListItem Text="Technical Writer" />
<asp:ListItem Text="Therapist" />
<asp:ListItem Text="Translator" />
<asp:ListItem Text="Waitress / Waiter" />
<asp:ListItem Text="Web designer / author" />
<asp:ListItem Text="Writer" />
<asp:ListItem Text="Other" />
</td>
</tr>
<tr>
<td align="left" colspan="2">
<label for="txtPersonalWebsite">
Personal Website</label><br />
<asp:TextBox ID="txtWebsite" runat="server" hight="50px" Width="400px" />
</td>
</tr>
<tr>
<td>
<label for="txtCountry">
Country</label>
</td>
<td>
<asp:DropDownList ID="ddlCountries" runat="server" AppendDataBoundItems="True"
Width="200px">
<asp:ListItem Selected="True" Text="Please select one..." />
</td>
</tr>
<tr>
<td align="left" colspan="2">
<label for="txtAddress">
Address</label><br />
<asp:TextBox ID="txtAddress" runat="server" TextMode="MultiLine"
Width="400px" />
</td>
</tr>
<tr>
<td>
<label for="txtApartmentNumber">
Apartment Number</label>
</td>
<td align="left">
<asp:TextBox ID="txtAptNumber" runat="server" Width="200px" />
</td>
<td>
<label for="txtCity">
City</label>
</td>
<td>
<asp:TextBox ID="txtCity" runat="server" Width="200px" />
</td>
</tr>
<tr>
<td>
<label for="txtState / Region">
State / Region</label>
</td>
<td>
<asp:DropDownList ID="ddlStates1" runat="server" AppendDataBoundItems="True"
Width="200px">
<asp:ListItem Selected="True" Text="Please select one..." />
</td>
<td>
<label for="txtZip / Postal code">
Zip / Postal code</label>
</td>
<td>
<asp:TextBox ID="txtPostalCode" runat="server" Width="200px" />
</td>
</tr>
<tr>
<td>
<label for="txtCONTACTINFO">
CONTACT INFO</label>
</td>
<td>
<asp:TextBox ID="txtContactInfo" runat="server" Width="200px">
</td>
</tr>
<tr>
<td>
<label for="txtDayTimePhone">
Day Time Phone</label>
</td>
<td>
<asp:TextBox ID="txtDayTimePhone" runat="server" Width="200px" />
</td>
<td>
<label for="txtDayTimePhoneExt">
Day Time Phone Ext</label>
</td>
<td>
<asp:TextBox ID="txtDayTimePhoneExt" runat="server" Width="200px" />
</td>
</tr>
<tr>
<td>
<label for="txtEveningPhone">
Evening Phone</label>
</td>
<td>
<asp:TextBox ID="txtEveningPhone" runat="server" Width="200px" />
</td>
<td>
<label for="txtEveningPhoneExt">
Evening Phone Ext</label>
</td>
<td>
<asp:TextBox ID="txtEveningPhoneExt" runat="server" Width="200px" />
</td>
</tr>
<tr>
<td>
<label for="txtCellPhone">
CellPhone</label>
</td>
<td>
<asp:TextBox ID="txtCellPhone" runat="server" Width="200px" />
</td>
</tr>
<tr>
<td align="left" colspan="2">
<label for="txtEMail">
EMail</label><br />
<asp:TextBox ID="txtEMail" runat="server" Width="400px" />
</td>
<td>
<label for="txtHomeFax">
Home Fax</label>
</td>
<td>
<asp:TextBox ID="txtHomeFax" runat="server" Width="200px" />
</td>
</tr>
<tr>
<td>
<label for="txtCOMPANYDETAILS">
COMPANY DETAILS</label>
</td>
</tr>
<tr>
<td colspan="2">
<label for="txtCompanyName">
Company Name</label>
<asp:TextBox ID="txtCompanyName" runat="server" Width="300px">
</td>
</tr>
<tr>
<td colspan="2">
<label for="txtAddress">
Address</label>
<asp:TextBox ID="txtCompanyAddress" runat="server" TextMode="MultiLine"
Width="350px">
</td>
</tr>
<tr>
<td>
<label for="txtCity">
City</label>
</td>
<td>
<asp:TextBox ID="txtCompanyCity" runat="server" Width="200px" />
</td>
<td>
<label for="txtState / Region">
State / Region</label>
</td>
<td>
<asp:DropDownList ID="ddlStates2" runat="server" align="right"
AppendDataBoundItems="True" Width="200px">
<asp:ListItem Selected="True" Text="Please select one..." />
</td>
</tr>
<tr>
<td>
<label for="txtZip">
Zip</label>
</td>
<td>
<asp:TextBox ID="txtCompanyZip" runat="server" Width="200px" />
</td>
<td>
<label for="txtCountry">
Country</label>
</td>
<td>
<asp:DropDownList ID="ddlCountries2" runat="server" AppendDataBoundItems="True"
Width="200px">
<asp:ListItem Selected="True" Text="Please select one..." />
</td>
</tr>
<tr>
<td>
<label for="txtPhone">
Phone</label>
</td>
<td>
<asp:TextBox ID="txtCompanyPhone" runat="server" Width="200px" />
</td>
<td>
<label for="txtFax">
Fax</label>
</td>
<td>
<asp:TextBox ID="txtCompanyFax" runat="server" Width="200px" />
</td>
</tr>
<tr>
<td colspan="2">
<label for="txtEMail">
EMail</label>
<asp:TextBox ID="txtCompanyEMail" runat="server" Width="350px" />
</td>
</tr>
<tr>
<td colspan="2">
<label for="txtWebSite">
WebSite</label>
<asp:TextBox ID="txtCompanyWebsite" runat="server" Width="330px" />
</td>
</tr>
<tr>
<td align="right">
<label for="txtNEWSLETTERSUBSCRIPTION">
NEWSLETTER SUBSCRIPTION</label>
</td>
</tr>
<tr>
<td>
<label for="txtNewsletter">
Newsletter</label>
</td>
<td>
<asp:DropDownList ID="ddlNewsletter" runat="server" Width="200px">
<asp:ListItem Selected="true" Text="No subscription" Value="None" />
<asp:ListItem Text="Subscribe to newsletter" Value="Html" />
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnUpdateProfile" runat="server"
OnClick="btnUpdateProfile_Click"
OnClientClick="return confirm('This will Update your Profile information..\n\rClick OK to continue.')"
Text="Save Profile" ValidationGroup="EditProfile" />
<asp:Label ID="lblProfileMessage" runat="server" />
</td>
</tr>
</caption>
</table>
</div>
<%----%>
</div>
<div id="Business" class="tab_content">
<%----%>
<table class="contentTemplate" align="center">
<asp:Repeater ID="repeaterBusinessInfo" runat="server">
<HeaderTemplate>
<tr>
<th>
BusinessID
</th>
<th>
BusinessName
</th>
<th>
BusinessAddress
</th>
</tr>
</HeaderTemplate>
<itemtemplate>
<tr>
<td>
<asp:Label ID="lblBusinessID" runat="server" Text='<%#((BusinessInfo)(Container.DataItem)).BusinessID%>'>
</td>
<td>
<a href="../Business/EditBusinessProfile.aspx?BusinessID=<%#((BusinessInfo)(Container.DataItem)).BusinessID%>">
<%#((BusinessInfo)(Container.DataItem)).BusinessID%>
<%#((BusinessInfo)(Container.DataItem)).BusinessName%></a>
</td>
<td>
<%#string.Format("{0} {1}, {2} {3} {4} {5}",((BusinessInfo)(Container.DataItem)).Address1, ((BusinessInfo)(Container.DataItem)).Address2,((BusinessInfo)(Container.DataItem)).City,((BusinessInfo)(Container.DataItem)).State,((BusinessInfo)(Container.DataItem)).Zip,((BusinessInfo)(Container.DataItem)).Country)%>
</td>
</tr>
</itemtemplate>
<tr>
<td align="center">
<asp:Button ID="btnNewBusiness" runat="server" Text="New Business" PostBackUrl="~/Business/EditBusinessProfile.aspx?BusinessID=0" />
</td>
</tr>
</table>
<div align="right" style="margin-removed 40px">
<asp:HyperLink ID="linkPrev" runat="server"><< <asp:Label ID="Label1" runat="server"> <asp:HyperLink ID="linkNext" runat="server">>>
</div>
<%-- </contenttemplate>
--%>
</div>
<div id="Notifications" class="tab_content">
<%--<cc1:TabPanel ID="panelNotifications" runat="server" HeaderText="Notifications">
<contenttemplate>
<br />
<br />
<br />--%>
<div align="center">
<table class="contentTemplate" align="center">
<asp:GridView ID="grvNotifications" runat="server" DataKeyNames="NotificationID"
AutoGenerateColumns="False"
PageSize="2" OnPageIndexChanged="grvNotifications_PageIndexChanged"
onpageindexchanging="grvNotifications_PageIndexChanging" AllowPaging="True">
<columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:Label ID="lblHeader" Text="Select BusinessName" runat="server" Width="120px" />
</HeaderTemplate>
<itemtemplate>
<asp:LinkButton ID="hlkBusinessName" runat="server" Text='<%#Eval("Header")%>' CommandName="Select" />
</itemtemplate>
<asp:BoundField DataField="NotificationID" HeaderText="NotificationID" />
<asp:BoundField DataField="UserId" HeaderText="UserId" />
<asp:BoundField DataField="NotificationDate" HeaderText="NotificationDate" />
</columns>
<footerstyle font-bold="True" />
<pagersettings position="Bottom" mode="NextPreviousFirstLast" firstpagetext="<<">
LastPageText=">>" NextPageText=">" PreviousPageText="<" />
<pagerstyle horizontalalign="Right" font-bold="False" font-overline="False">
Font-Size="Small" ForeColor="Black" Height="5px" />
</pagerstyle></pagersettings></table>
</div>
<%-- </contenttemplate>
--%>
</div>
</div>
</div>
</div>
</contenttemplate></div>
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Profile;
using System.Web.Security;
using System.Web.UI.WebControls;
using Vascape.DataLayer;
using TI.Membership.Library;
using Vascape.BusinessLayer;
namespace TI.Membership.Web.members.controls
{
public partial class BusinessMembershipInfo : System.Web.UI.UserControl
{
#region on page load get current profile
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
grvNotifications.PageIndex = 0;
LoadGrid();
MembershipUser user = System.Web.Security.Membership.GetUser();
repeaterBusinessInfo.DataSource = BusinessManager.GetBusinessInfos((Guid)user.ProviderUserKey);
repeaterBusinessInfo.DataBind();
if (!Page.IsPostBack)
{
PagedDataSource pds = new PagedDataSource();
pds.DataSource = BusinessManager.GetBusinessInfos((Guid)user.ProviderUserKey);
pds.AllowPaging = true;
pds.PageSize = 10;
int currentPage;
if (Request.QueryString["page"] != null)
{
currentPage = Int32.Parse(Request.QueryString["page"]);
}
else
{
currentPage = 1;
}
pds.CurrentPageIndex = currentPage - 1;
Label1.Text = currentPage + " / " + pds.PageCount;
if (!pds.IsFirstPage)
{
linkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?page=" + (currentPage - 1);
}
if (!pds.IsLastPage)
{
linkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?page=" + (currentPage + 1);
}
repeaterBusinessInfo.DataSource = pds;
repeaterBusinessInfo.DataBind();
}
}
if (!Page.IsPostBack)
{
if (Page.User.Identity.IsAuthenticated)
{
ddlCountries.DataSource = CountryNames.GetCountries();
ddlCountries.DataBind();
ddlCountries2.DataSource = CountryNames.GetCountries();
ddlCountries2.DataBind();
ddlStates1.DataSource = StateNames.GetStates();
ddlStates1.DataBind();
ddlStates2.DataSource = StateNames.GetStates();
ddlStates2.DataBind();
ProfileCommon profile = null;
if (HttpContext.Current.Profile != null)
{
profile = (ProfileCommon)HttpContext.Current.Profile;
}
if (profile != null)
{
ddlNewsletter.SelectedValue = profile.Preferences.Newsletter;
txtFirstName.Text = profile.Personal.FirstName;
txtLastName.Text = profile.Personal.LastName;
ddlGenders.SelectedValue = profile.Personal.Gender;
if (profile.Personal.BirthDate != DateTime.MinValue)
txtBirthDate.Text = profile.Personal.BirthDate.ToShortDateString();
ddlOccupations.SelectedValue = profile.Personal.Occupation;
txtWebsite.Text = profile.Personal.Website;
ddlCountries.SelectedValue = profile.Address.Country;
txtAddress.Text = profile.Address.Address;
txtAptNumber.Text = profile.Address.AptNumber;
txtCity.Text = profile.Address.City;
ddlStates1.SelectedValue = profile.Company.State;
txtPostalCode.Text = profile.Address.PostalCode;
txtDayTimePhone.Text = profile.Contacts.DayPhone;
txtDayTimePhoneExt.Text = profile.Contacts.DayPhoneExt;
txtEveningPhone.Text = profile.Contacts.EveningPhone;
txtEveningPhoneExt.Text = profile.Contacts.EveningPhoneExt;
txtCellPhone.Text = profile.Contacts.CellPhone;
txtEMail.Text = profile.Contacts.EMail;
txtHomeFax.Text = profile.Contacts.Fax;
txtCompanyName.Text = profile.Company.Company;
txtCompanyAddress.Text = profile.Company.Address;
txtCompanyCity.Text = profile.Company.City;
ddlStates2.SelectedValue = profile.Company.State;
txtCompanyZip.Text = profile.Company.PostalCode;
txtCompanyPhone.Text = profile.Company.Phone;
txtCompanyEMail.Text = profile.Company.EMail;
txtCompanyFax.Text = profile.Company.Fax;
txtCompanyWebsite.Text = profile.Company.Website;
ddlNewsletter.SelectedValue = profile.Preferences.Newsletter;
}
}
}
}
protected void grvNotifications_PageIndexChanged(object sender, EventArgs e)
{
LoadGrid();
}
private void LoadGrid()
{
MembershipUser user = System.Web.Security.Membership.GetUser();
grvNotifications.DataSource = BusinessNotificationsManager.GetUserNotifications((Guid)user.ProviderUserKey);
grvNotifications.DataBind();
}
protected void grvNotifications_PageIndexChanging(Object sender, GridViewPageEventArgs e)
{
grvNotifications.PageIndex = e.NewPageIndex;
LoadGrid();
}
#endregion
#region Update current Profile Sub
public void SaveProfile()
{
if (Page.User.Identity.IsAuthenticated)
{
ProfileCommon profile = HttpContext.Current.Profile as ProfileCommon ?? new ProfileCommon();
profile.Personal.FirstName = txtFirstName.Text;
profile.Personal.LastName = txtLastName.Text;
profile.Personal.Gender = ddlGenders.SelectedValue;
if (txtBirthDate.Text.Trim().Length > 0)
profile.Personal.BirthDate = DateTime.Parse(txtBirthDate.Text);
profile.Personal.Occupation = ddlOccupations.SelectedValue;
profile.Personal.Website = txtWebsite.Text;
profile.Address.Country = ddlCountries.SelectedValue;
profile.Address.Address = txtAddress.Text;
profile.Address.AptNumber = txtAptNumber.Text;
profile.Address.City = txtCity.Text;
profile.Address.State = ddlStates1.SelectedValue;
profile.Address.PostalCode = txtPostalCode.Text;
profile.Contacts.DayPhone = txtDayTimePhone.Text;
profile.Contacts.DayPhoneExt = txtDayTimePhoneExt.Text;
profile.Contacts.EveningPhone = txtEveningPhone.Text;
profile.Contacts.EveningPhoneExt = txtEveningPhoneExt.Text;
profile.Contacts.CellPhone = txtCellPhone.Text;
profile.Contacts.Fax = txtHomeFax.Text;
profile.Company.Company = txtCompanyName.Text;
profile.Company.Address = txtCompanyAddress.Text;
profile.Company.City = txtCompanyCity.Text;
profile.Company.State = ddlStates2.SelectedValue;
profile.Company.PostalCode = txtCompanyZip.Text;
profile.Company.Phone = txtCompanyPhone.Text;
profile.Company.Fax = txtCompanyFax.Text;
profile.Company.EMail = txtCompanyEMail.Text;
profile.Company.Website = txtCompanyWebsite.Text;
profile.Preferences.Newsletter = ddlNewsletter.SelectedValue;
profile.Save();
}
}
#endregion
#region update user info in detailsview
protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
{
MembershipUser memUser = System.Web.Security.Membership.GetUser();
memUser.Email = (string)e.NewValues[0];
try
{
System.Web.Security.Membership.UpdateUser(memUser);
e.Cancel = true;
DetailsView1.ChangeMode(DetailsViewMode.ReadOnly);
}
catch (Exception ex)
{
Response.Write("<div>The following error occurred:<font color="red"> " + ex.Message + "</font></div>");
e.Cancel = true;
}
}
#endregion
#region delete user account
protected void btnDeleteCurrentUser_Click(object sender, EventArgs e)
{
if (System.Web.Security.Membership.DeleteUser(Page.User.Identity.Name))
{
FormsAuthentication.SignOut();
Roles.DeleteCookie();
Response.Redirect("~/account-removed.aspx");
}
else
{
lblResult.Visible = true;
lblResult.Text = "The Membership user was not deleted.";
}
}
#endregion
#region Update current Profile Button Click
protected void btnUpdateProfile_Click(object sender, EventArgs e)
{
SaveProfile();
lblProfileMessage.Text = "Profile saved successfully!";
}
#endregion
#region end all user sessions on logout
protected void LoginStatus1_LoggingOut(object sender, LoginCancelEventArgs e)
{
Session.Clear();
Session.Abandon();
Session.RemoveAll();
}
#endregion
#region Get all Notifications
#endregion
}
}