Click here to Skip to main content
15,891,375 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: RadEditor is disabled possibly because of AJAX Manager Pin
indian1436-Jan-16 10:33
indian1436-Jan-16 10:33 
QuestionAbout Online Shopping In Asp.net and linq Pin
SunnyMistry0074-Jan-16 22:36
SunnyMistry0074-Jan-16 22:36 
AnswerRe: About Online Shopping In Asp.net and linq Pin
F-ES Sitecore4-Jan-16 22:48
professionalF-ES Sitecore4-Jan-16 22:48 
AnswerRe: About Online Shopping In Asp.net and linq Pin
Afzaal Ahmad Zeeshan5-Jan-16 0:05
professionalAfzaal Ahmad Zeeshan5-Jan-16 0:05 
Questionasp.net mvc with desktop ui. HowTo? Pin
Frygreen4-Jan-16 9:23
Frygreen4-Jan-16 9:23 
AnswerRe: asp.net mvc with desktop ui. HowTo? Pin
Afzaal Ahmad Zeeshan5-Jan-16 0:26
professionalAfzaal Ahmad Zeeshan5-Jan-16 0:26 
AnswerRe: asp.net mvc with desktop ui. HowTo? Pin
Frygreen5-Jan-16 13:10
Frygreen5-Jan-16 13:10 
QuestionAdding Objects To Session Pin
ASPnoob4-Jan-16 7:15
ASPnoob4-Jan-16 7:15 
I have a list called List < Accounts > where I can add customers' info after supplying the needed data and clicking the Add button on my webform. To persist my data between postbacks I stored my data in a session variable then retrieve them from that session variable later on.

The problem is the session variable only shows one account even though I added multiple accounts. The folloewng is my code.

C#
List<Account> accts = new List<Account>();

protected void btnShowAccountDetails_Click(object sender, EventArgs e)
{
    StringBuilder acctDetails = new StringBuilder(); 
 
    if (Session["acctObjects"] != null)
    accts = (List<acct>)Session["acctObjects"];
    
    foreach(Account acct in accts)
    {
     acctDetails.Append("ID: "+ acct.Name + " Account ID: " + acct.AccountID + "<br/>");
    }   

    litCtrShowAccountDetails.Text = acctDetails.ToString();
}

protected void btnAddAcctount_Click(object sender, EventArgs e)
{   
    Account acct = new Account();
    StringBuilder acctDetails = new StringBuilder();
	 
    if (!String.IsNullOrEmpty(txtName.Text))
    {
	acct.Name = txtName.Text;	
    }
    else
    {
	//Display Error message
	ScriptManager.RegisterStartupScript(this, GetType(), "EmptyName", "EmptyNameAlert();", true);
    }

    if (!String.IsNullOrEmpty(txtAccountID.Text))
    {
	acct.AccountID = txtAccountID.Text;	
    }
    else
    {
	//Display Error message
	ScriptManager.RegisterStartupScript(this, GetType(), "EmptytAccountID", "EmptytAccountIDAlert();", true);
    }
  
    accts.Add(acct);
    Session["acctObjects"] = accts;
}


Please help me resolve this issue, thanks in advance.

modified 4-Jan-16 13:23pm.

AnswerRe: Adding Objects To Session Pin
ZurdoDev4-Jan-16 8:24
professionalZurdoDev4-Jan-16 8:24 
AnswerRe: Adding Objects To Session Pin
Mathi Mani4-Jan-16 8:58
Mathi Mani4-Jan-16 8:58 
AnswerRe: Adding Objects To Session Pin
ASPnoob4-Jan-16 10:55
ASPnoob4-Jan-16 10:55 
GeneralRe: Adding Objects To Session Pin
F-ES Sitecore4-Jan-16 22:46
professionalF-ES Sitecore4-Jan-16 22:46 
GeneralRe: Adding Objects To Session Pin
Richard Deeming5-Jan-16 2:28
mveRichard Deeming5-Jan-16 2:28 
GeneralRe: Adding Objects To Session Pin
F-ES Sitecore5-Jan-16 2:59
professionalF-ES Sitecore5-Jan-16 2:59 
GeneralRe: Adding Objects To Session Pin
Richard Deeming5-Jan-16 7:34
mveRichard Deeming5-Jan-16 7:34 
GeneralRe: Adding Objects To Session Pin
F-ES Sitecore6-Jan-16 22:47
professionalF-ES Sitecore6-Jan-16 22:47 
QuestionCreate an ASP.NET Page with a scheduler application Pin
Helgard W29-Dec-15 21:40
Helgard W29-Dec-15 21:40 
SuggestionRe: Create an ASP.NET Page with a scheduler application Pin
Richard MacCutchan29-Dec-15 22:38
mveRichard MacCutchan29-Dec-15 22:38 
GeneralRe: Create an ASP.NET Page with a scheduler application Pin
Helgard W29-Dec-15 22:45
Helgard W29-Dec-15 22:45 
AnswerRe: Create an ASP.NET Page with a scheduler application Pin
Anurag Gandhi29-Dec-15 22:45
professionalAnurag Gandhi29-Dec-15 22:45 
AnswerRe: Create an ASP.NET Page with a scheduler application Pin
Helgard W29-Dec-15 22:47
Helgard W29-Dec-15 22:47 
AnswerRe: Create an ASP.NET Page with a scheduler application Pin
Zubair Khan May202324-May-23 2:01
Zubair Khan May202324-May-23 2:01 
Questionweb form application accessing ssrs reports Pin
dcof28-Dec-15 6:34
dcof28-Dec-15 6:34 
QuestionFreddy Kruger Fixed Pin
BobbyStrain24-Dec-15 7:16
BobbyStrain24-Dec-15 7:16 
Questionhow to start android mobile app development Pin
Member 1187868023-Dec-15 8:30
Member 1187868023-Dec-15 8:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.