using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class MyAccount : System.Web.UI.Page
{
RegisterDC registerDC = new RegisterDC();
protected void Page_Load(object sender, EventArgs e)
{
pradeep cend...
Member
7 Points
13 Posts
my account can any one help how to write .cscode for below design
May 01, 2012 05:52 AM|LINK
MyAccount.aspx
<%@ Page Title="CarWash|MyAccount" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeFile="MyAccount.aspx.cs" Inherits="MyAccount" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
<h1>
MyProfile</h1>
<div class="accountInfo">
<fieldset>
<legend><b>My Account</b></legend>
<asp:Label ID="ShippingAddressIdLabel" runat="server" Visible="false"></asp:Label>
<asp:Label ID="BillingAddressIdLabel" runat="server" Visible="false"></asp:Label>
<p>
<span>FirstName: </span>
<asp:Label ID="FirstNameLabel" runat="server"></asp:Label>
</p>
<p>
<span>LastName: </span>
<asp:Label ID="LastNameLabel" runat="server"></asp:Label>
</p>
<p>
<span>Email: </span>
<asp:Label ID="EmailIdLabel" runat="server"></asp:Label>
</p>
</fieldset>
</div>
<div class="Shipping Address">
<fieldset class="ShippingAddress">
<legend><b>Shipping Address</b></legend>
<p>
<span>ShippingCompany: </span>
<asp:Label ID="ShippingCompanyLabel" runat="server"></asp:Label>
</p>
<p>
<span>ShippingFirstName: </span>
<asp:Label ID="ShippingFirstNameLabel" runat="server"></asp:Label>
</p>
<p>
<span>ShippingLastName: </span>
<asp:Label ID="ShippingLastNameLabel" runat="server"></asp:Label>
</p>
<p>
<span>ShippingAddress1: </span>
<asp:Label ID="ShippingAddress1Label" runat="server"></asp:Label>
</p>
<p>
<span>ShippingAddress2: </span>
<asp:Label ID="ShippingAddress2Label" runat="server"></asp:Label>
</p>
<p>
<span>ShippingCity: </span>
<asp:Label ID="ShippingCityLabel" runat="server"></asp:Label>
</p>
<p>
<span>ShippingState: </span>
<asp:Label ID="ShippingStateLabel" runat="server"></asp:Label>
</p>
<p>
<span>ShippingZipCode: </span>
<asp:Label ID="ShippingZipCodeLabel" runat="server"></asp:Label>
</p>
<p>
<span>ShippingPhoneNumber: </span>
<asp:Label ID="ShippingPhoneNumberLabel" runat="server"></asp:Label>
</p>
<p>
<span>ShippingFaxNumber: </span>
<asp:Label ID="ShippingFaxNumberLabel" runat="server"></asp:Label>
</p>
<p>
<span>ShippingEmailId: </span>
<asp:Label ID="ShippingEmailIdLabel" runat="server"></asp:Label>
</p>
</fieldset>
</div>
<div class="Billing Address">
<fieldset class="BillingAddress">
<legend><b>Billing Address</b></legend>
<p>
<span>BillingCompany: </span>
<asp:Label ID="BillingCompanyLabel" runat="server"></asp:Label>
</p>
<p>
<span>BillingFirstName: </span>
<asp:Label ID="BillingFirstNameLabel" runat="server"></asp:Label>
</p>
<p>
<span>BillingLastName: </span>
<asp:Label ID="BillingLastNameLabel" runat="server"></asp:Label>
</p>
<p>
<span>BillingAddress1: </span>
<asp:Label ID="BillingAddress1Label" runat="server"></asp:Label>
</p>
<p>
<span>BillingAddress2: </span>
<asp:Label ID="BillingAddress2Label" runat="server"></asp:Label>
</p>
<p>
<span>BillingCity: </span>
<asp:Label ID="BillingCityLabel" runat="server"></asp:Label>
</p>
<p>
<span>BillingState: </span>
<asp:Label ID="BillingStateLabel" runat="server"></asp:Label>
</p>
<p>
<span>BillingZipCode: </span>
<asp:Label ID="BillingZipCodeLabel" runat="server"></asp:Label>
</p>
<p>
<span>BillingPhoneNumber: </span>
<asp:Label ID="BillingPhoneNumberLabel" runat="server"></asp:Label>
</p>
<p>
<span>BillingFaxNumber: </span>
<asp:Label ID="BillingFaxNumberLabel" runat="server"></asp:Label>
</p>
<p>
<span>BillingEmailId: </span>
<asp:Label ID="BillingEmailIdLabel" runat="server"></asp:Label>
</p>
</fieldset>
</div>
<asp:Button ID="EditProfileButton" runat="server" Text="EditProfile" OnClick="EditProfileButton_Click" />
</asp:Content>
i write like this
MyAccount.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class MyAccount : System.Web.UI.Page
{
RegisterDC registerDC = new RegisterDC();
protected void Page_Load(object sender, EventArgs e)
{
registerDC.CustomerId = Convert.ToInt32(registerDC.CustomerId);
registerDC = RegisterBAL.EditGetMyInformation(registerDC);
if (registerDC.registerDS.Tables[0].Rows.Count > 0)
{
FirstNameLabel.Text = registerDC.registerDS.Tables[0].Rows[0]["FirstName"].ToString();
LastNameLabel.Text = registerDC.registerDS.Tables[0].Rows[0]["LastName"].ToString();
EmailIdLabel.Text = registerDC.registerDS.Tables[0].Rows[0]["EMail"].ToString();
ShippingAddressIdLabel.Text = registerDC.registerDS.Tables[0].Rows[0]["ShippingAddressId"].ToString();
BillingAddressIdLabel.Text = registerDC.registerDS.Tables[0].Rows[0]["BillingAddressId"].ToString();
}
if (registerDC.registerDS.Tables[1].Rows.Count > 0)
{
ShippingFirstNameLabel.Text = registerDC.registerDS.Tables[1].Rows[0]["FirstName"].ToString();
ShippingLastNameLabel.Text = registerDC.registerDS.Tables[1].Rows[0]["LastName"].ToString();
ShippingCompanyLabel.Text = registerDC.registerDS.Tables[1].Rows[0]["Company"].ToString();
ShippingAddress1Label.Text = registerDC.registerDS.Tables[1].Rows[0]["Address1"].ToString();
ShippingAddress2Label.Text = registerDC.registerDS.Tables[1].Rows[0]["Address2"].ToString();
ShippingCityLabel.Text = registerDC.registerDS.Tables[1].Rows[0]["City"].ToString();
ShippingStateLabel.Text = registerDC.registerDS.Tables[1].Rows[0]["State"].ToString();
ShippingZipCodeLabel.Text = registerDC.registerDS.Tables[1].Rows[0]["ZipPostalCode"].ToString();
ShippingPhoneNumberLabel.Text = registerDC.registerDS.Tables[1].Rows[0]["PhoneNumber"].ToString();
ShippingFaxNumberLabel.Text = registerDC.registerDS.Tables[1].Rows[0]["FaxNumber"].ToString();
ShippingEmailIdLabel.Text = registerDC.registerDS.Tables[1].Rows[0]["Email"].ToString();
}
if (registerDC.registerDS.Tables[2].Rows.Count > 0)
{
BillingFirstNameLabel.Text = registerDC.registerDS.Tables[2].Rows[0]["FirstName"].ToString();
BillingLastNameLabel.Text = registerDC.registerDS.Tables[2].Rows[0]["LastName"].ToString();
BillingCompanyLabel.Text = registerDC.registerDS.Tables[2].Rows[0]["Company"].ToString();
BillingAddress1Label.Text = registerDC.registerDS.Tables[2].Rows[0]["Address1"].ToString();
BillingAddress2Label.Text = registerDC.registerDS.Tables[2].Rows[0]["Address2"].ToString();
BillingCityLabel.Text = registerDC.registerDS.Tables[2].Rows[0]["City"].ToString();
BillingStateLabel.Text = registerDC.registerDS.Tables[2].Rows[0]["State"].ToString();
BillingZipCodeLabel.Text = registerDC.registerDS.Tables[2].Rows[0]["ZipPostalCode"].ToString();
BillingPhoneNumberLabel.Text = registerDC.registerDS.Tables[2].Rows[0]["PhoneNumber"].ToString();
BillingFaxNumberLabel.Text = registerDC.registerDS.Tables[2].Rows[0]["FaxNumber"].ToString();
BillingEmailIdLabel.Text = registerDC.registerDS.Tables[2].Rows[0]["Email"].ToString();
}
}
protected void EditProfileButton_Click(object sender, EventArgs e)
{
Response.Redirect("EditUsers.aspx");
}
}
no display when i am running what is the problem can any one help
chaaraan
Contributor
2170 Points
484 Posts
Re: my account can any one help how to write .cscode for below design
May 01, 2012 06:02 AM|LINK
Hi Pradeep
Can you explain what is that RegisterDC which you are using
RegisterDC registerDC = new RegisterDC();
From where are you fetching the data?
Regards,
Charan
praseTech
Member
198 Points
51 Posts
Re: my account can any one help how to write .cscode for below design
May 01, 2012 06:03 AM|LINK
Can you please post some more description about what you want to achive?
adeelehsan
All-Star
18267 Points
2732 Posts
Re: my account can any one help how to write .cscode for below design
May 01, 2012 06:04 AM|LINK
What is the value of registerDC.CustomerId in the following line:
registerDC.CustomerId = Convert.ToInt32(registerDC.CustomerId);
Make sure it has a valid value. Because it seems that there is no data against it. You are creating a new object using:
RegisterDC registerDC = new RegisterDC();
So it seems CustomerId will either be 0 or any default value that does not have any data against it.
MCPD ASP.NET 4.0 and 3.5, MCTS WSS, MOSS, SharePoint 2010, MCT
Microsoft Community Contributor Award 2011
pradeep cend...
Member
7 Points
13 Posts
Re: my account can any one help how to write .cscode for below design
May 01, 2012 06:05 AM|LINK
generally we have myprofile in our login that i want now actually
...
pradeep cend...
Member
7 Points
13 Posts
Re: my account can any one help how to write .cscode for below design
May 01, 2012 06:06 AM|LINK
hi adeelehsan its seem CustomerId 0 how can i write for that i am new for .net
sravanisrav
Member
470 Points
107 Posts
Re: my account can any one help how to write .cscode for below design
May 01, 2012 07:33 AM|LINK
hello Pradeep,
I think RegisterDC is your Data Class in which you have created all the properties for the columns in the table.
Try to refer this link before starting the Application:
http://www.bestdotnettraining.com/Online/Training/CSharp/Data-Access-using-ADO-NET-DataSet/43
Thanks & Regards
Sravani