State Management :: Multidimentional Arraylist / Create A Arraylist Which Will Able To Store User Info?

Jul 16, 2010

i want to create a arraylist which will able to store user info like (username,machineIP,port ) for each user in the list & retrive this data when needed . any one tell me how i can do it or any alternative way without database or xml file.

View 6 Replies


Similar Messages:

State Management :: Store An ArrayList Into A Session Variable?

Apr 23, 2010

I'm looking store an ArrayList into a session variable, but am having a few problems. Can you spot anything wrong?

public partial class _Default : System.Web.UI.Page { ArrayList score = new ArrayList(); protected void twist2(object sender, EventArgs e) { int a = 11; int c = RandomNumber(a); score.Add(c); score = (ArrayList)Session["scoreData"]; Result.Text = (c).ToString(); String Result_id = Result.Text; int total = 0; //Session["scoreData"] = score; for (int i = 0; i < score.Count; ++i) { total += (int)score[i]; } Sum.Text = (total).ToString(); String Sum_id = Sum.Text; }

View 3 Replies

State Management :: Accessing Session Arraylist

Jul 13, 2010

I am using a Session Arraylist to hold information about an online user. However, I am having troubel accessing the data. The error seems to be in the last bit because I can access one value of sample data just not print out a number of values. I have an class penalyPoint that has the following constructor:

public PenaltyPoint(string penaltyCode1, string penaltyDate1, string PenaltyPointsAwarded1, string penaltyBan1)

Then in a button response I have the following response which holds the data in a session arraylist variable as the user can enter a number of these objects. I will put a capacity limit on the arraylist later on.

//Assign the data in the form to a PenaltyPoint Object
PenaltyPoint penPoint = new PenaltyPoint(ddlPen1Code.SelectedValue, txtPenDate.Text, txtPen1Points.Text, txtPen1Ban.Text);
//The current driver number has to be set before this page is called
//Temp
int currentDriver = 0;
//int currentDriver = (int)(Session["currentDriverNum"]);
//create an arraylist to be used for transferring arraylist to session
ArrayList penPointsDrive0Array = new ArrayList();
if (currentDriver == 0)
{
//if the session is equal to null then nothing has to be returned from session
if (Session["penPointsArrayListDrive0"] == null)
{
penPointsDrive0Array.Add(penPoint);
Session["penPointsArrayListDrive0"] = penPointsDrive0Array;
Response.Redirect("PenaltyPoints.aspx");
}
else
{
penPointsDrive0Array = (ArrayList)Session["penPointsArrayListDrive0"];
penPointsDrive0Array.Add(penPoint);
Session["penPointsArrayListDrive0"] = penPointsDrive0Array;
Response.Redirect("PenaltyPoints.aspx");
}
}

Then I try to access the data in the arraylist but I getting nothing printing out. I am just trying to test the data at the minute. I am not that use to arraylist so this might be the problem.

public partial class TestPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ArrayList answer = new ArrayList();
ArrayList driver1 = (ArrayList)Session["penPointsArrayListDrive0"];
PenaltyPoint ps = new PenaltyPoint();
string output;
for (int i = 0; i < driver1.Count; i++)
{
ps = (PenaltyPoint)driver1[i];
string answertemp = ps.getPenaltyCode();
output = answertemp;
}
}
}

I can't get the final part to collect all the values into a string it keeps on coming up with errors.

View 2 Replies

State Management :: Memory Size Of Session / ArrayList?

Apr 24, 2010

I am using ASP.NET 2.0.

In my applicaion, I store some values in an ArrayList and store this Arraylist in a session variable. I want to know the size of this session variable in memory. Is there any method to do this.

View 6 Replies

Can Store Image Data In Arraylist

May 15, 2010

Can i store Image data in Array list.

View 4 Replies

Perform User Management (store User Info, Login , Logout Etc) Without Using Session Or Cookie?

Dec 1, 2010

Is it possible to perform user management (store user info, login , logout etc) without using session or cookie?

View 3 Replies

Session State ArrayList In Shopping Cart?

May 1, 2010

I'm creating a shopping cart application and I'm having some issues with implementing a session state for my arraylist.

in my page load i declared

if (Session["Cart"] == null)
{
Session["Cart"] = new ArrayList();
}
else
{
ArrayList cart = (ArrayList)Session["Cart"];
}

to create the session if it doesn't exist yet.
then i have an event handler for a button to add items to the arraylist

protected void onClick_AddBooking(object sender, EventArgs e)
{
int ClassID = Convert.ToInt32(Request.QueryString.Get("Class_Id"));
ArrayList cart1 = new ArrayList();
cart1 = Session["Cart"];
cart1.Add(ClassID);

I'm essentially storing the class_ID then when the student confirms i'll store that to the DB and associate that ID with the Class Details.

View 1 Replies

AJAX :: AutoComplete Extender Web Service - Select Client Names From Sql Server Then Store Into Arraylist

Jul 26, 2010

I am not sure about writing the method in the web service. I'm trying to select the client names from sql server, then storing them into an arraylist. Finally, returning the array of names. This is my code:

[Code]....

My method has an error.

View 9 Replies

Forms Data Controls :: Store The Gridview Selected Box In Arraylist And Update The Database According To The List?

Mar 15, 2011

I am working in asp.net 3.5 with c# and sqlserver 2005 as database. I my project i have to select some of the checkbox of a gridview and update the database according to that. I want to store all the selected box in a arraylist and update the database according to the selected list . But i am not getting how to proceed.

View 3 Replies

AJAX :: How To Create Arraylist And Remove Elements

Mar 25, 2010

I need to initiate an Array to hold 100 integers. Then, by user click, a random number 1-100 is generated, and subtracted from the list. In the next call, the next random number will be subtracted from the 99 numbers left, next from the 98 numbers and so on. I need to do this with AJAX and if needed a webservice. The reason I am asking here is because I am confused...Where shall I instanciate the array and how do I keep track of the removed numbers?

View 1 Replies

Forms Data Controls :: Create Graph From ArrayList?

Jan 21, 2011

I have an arraylist that contains some values. (e.g. playerName). I also queried for values in the database (e.g. playerName, playerSales) and I need to match the playerName in the arraylist to the corresponding ones that I did a query from the database. (match those with the same playerName). From there, I need to create a bar graph with the respective playerName and their sales (playerSales).

A portion of the code is shown below:

[Code]....

The arraylist I mentioned was saved to a session to be used in another page. Is my code right? And how can I create the graph from the values?

View 1 Replies

Forms Data Controls :: Create Bar Graph From ArrayList And DataSource?

Jan 16, 2011

I have a web page where a GridView will be shown with a column of different products and another column with checkboxes. Checking on the checkboxes will be equivalent to selecting the products. The selected products are saved to an arraylist. Then, the user has to click on a button located on the same page to analyze the selected products. On clicking the button, he/she will be directed to another page where a bar graph will be shown. The bar graph will be the result of having analyzed the products. How do I create the bar graph where the products are taken from the arraylist but I can make use of the datasource within the chart control to retrieve more detailed info(such as product sales) from the database, taking into account the products from the arraylist?

View 3 Replies

Custom Type Within ArrayList Inside Of The User Profile In C#?

Jan 22, 2010

I'm getting the following error when trying to save a custom class within my ArrayList within my user profile:

There was an error generating the XML document. ---> System.InvalidOperationException: The type Com.xxx.MyDataClass was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.

My web.config has something like:

<profile enabled="true" automaticSaveEnabled="false" defaultProvider="xxxxxxProvider">
<properties>
<add name="MyData" type="System.Collections.ArrayList"/>
</properties>
</profile>

I am trying to store my class called (something like) MyDataClass in an ArrayList into MyData. When I save I get the error above. The class MyDataClass has just two members for now, both set as 'string'.

I assume I have to tell the class has to serialize itself but I'm not sure how.

Here's the class:

namespace Com.xxxx.DataClasses
{
public class MyDataClass : ISerializable
{
public string elem1;
public string elem2;
public string Elem1
{
get { return elem1; }
set { elem1 = value; }
}
public string Elem2
{
get { return elem2; }
set { elem2 = value; }
}
....

UPDATE: FIXED

I was able to fix this issue via the following:

First of all here is a good resource: http://msdn.microsoft.com/en-us/library/d8b58y5d.aspx

I changed the profile entries to be:

<profile enabled="true" automaticSaveEnabled="false" defaultProvider="xxxxxxProvider">
<properties>
<add name="MyData" type="mypackage.MyDataClass" serializeAs="binary"/>
</properties>
</profile>

and then I created MyDataClass to contain a List<> of MyDataClassInfo objects similar to:

namespace Com.xxxx.DataClasses
{
[Serializable]
public class MyDataClass
{
List<MyDataClassInfo> myDataClassInfo;
public MyDataClassInfo()
{
myDataClassInfo = new List<MyDataClassInfo>;
}
public List<MyDataClassInfo> MyDataClassInfo
{
get;
set;
}
}

[Serializable]

public class MyDataClassInfo
{
public string elem1;
public string elem2;
public string Elem1
{
get { return elem1; }
set { elem1 = value; }
}
public string Elem2
{
get { return elem2; }
set { elem2 = value; }
}
....

The key here was 1) using the serializeAt="binary" and 2) using a class which contained a list instead of a list within the profile.

View 2 Replies

State Management :: How To Store A Large Amount Of Data In User's Session

Sep 29, 2010

I need to store a large amount of data in user's session but I guess using Session Object is not the best way of doing that. Is there any other way around??? Remember I don't have small variables to store, I have large collections.

View 5 Replies

State Management :: Unable To Create A Persistent Cookie To Store A Preferred Language On Website

Feb 10, 2011

I try to create a persistent cookie to store a preferred language on our website, but it doesn't work.

So, to isolate the problem, I created a new website, with a blank page and with the code behind bellow. If I click the button, the page post back and I get this:

"Cookies expires: 0001-01-01 00:00:00 value: 10"

[Code]....

View 5 Replies

Security :: How To Store User Info In Web.config

Apr 26, 2010

Using visual studio 2010.

Dragged and dropped a login control onto a blank content page. Set up my web.config (i'll include the code for that at the end). It seems to want to use a sql database to store the info. I just want to use the web.config since it's just a single user and a simple site. I thought I could just drag and drop the login control to a page and that would be the end of it (besides setting up the web.config).

Here's what i have in the config file

[Code]....

View 2 Replies

Customize Createuserwizrad And Store Additional User Info?

Sep 24, 2010

I created a table(UserProfile) to store additional user info and create foreign key relationship btw UserId of UserProfile table & asp.net_Users table.

When i run the createuser page i have this error:

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_User_Profile_aspnet_Users1".
"dbo.aspnet_Users", column 'UserId'.
The statement has been terminated.

View 1 Replies

2 Dimensional ArrayList In VB.NET?

Jun 16, 2010

I am looping through a dataset and I would like to have the following in this array list

name, from, to, price
john, 40, 50, 39.99
mike, 20, 50, 49.99
etc.

Once I do that, or if it is possible to do it using the dataset that will work with me. But I want to do...

If john's price between from and to...

So in my code I wanted to make it easy for me and instead of memorizing the row #, I would just do.. arraylist.row("john").item("from")

View 6 Replies

Security :: Place To Store The User Logged-in ID (info) For Later Checking And Use?

Feb 1, 2010

I have read the post at http://forums.asp.net/t/1403132.aspx regarding login control. Is there a place to store the User logged-in ID (info) for later checking and use? I don't need to use the session object. I don't need the page to expire. I don't need the user to use a page saved in the favoites.

View 3 Replies

C# - How To Convert A Arraylist To String

Dec 6, 2010

How can I convert a arraylist to a string?

View 4 Replies

ADO.NET :: How To Order An Arraylist With Linq

Sep 9, 2010

Is there a way I can sort this query result in Linq? I'd like to sort in descending order by the .Count parameter:

[Code]....

View 2 Replies

ArrayList Binding To Gridview?

Jan 26, 2011

I have an arraylist of string items that I want to bind to a gridview.I want to bind the value from each item to a asp:HyperLinkField but I dont know what the DataTextField should be? The arraylist obviously doesn't have a column heading as it's just 1 dimensional.What value do I need to use in the DataTextField?

View 3 Replies

Web Forms :: Distinct Arraylist Value Using C#?

Feb 22, 2010

how to distinct arraylist value using c#?

View 10 Replies

Accessing ArrayList In Javascript

May 10, 2010

I have ArrayList in my Model and want to iterate through it in my javascript. I am using following code but its giving me error : CS0103: The name 'i' does not exist in the current context

for(var i=0; i <= <%=Model.KeyList.Count%>; i++)
{
alert('<%=Model.KeyList[i]%>');
}

How to get rid of this?

View 3 Replies

How To Do Empty Arraylist In Immediate Window

Jun 8, 2010

how can i do empty Arraylist in immediate window in asp.net

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved