-1

I am doing Project by asp.net. Some states of changing themes of page (setting allows users to change private themes).

For example: I used "jquery about sortable list". Users can sort position of items in this list. But i don't know how to save state of items after sorted by users for each user who did it.

List menu: Home About Default

Position of Home, About, Default can exchange for each others by user's sorting.

How to save sorting to DataBase for each user.

Tks !

aloha
  • 15
  • 4

3 Answers3

1

I think the best approach is: do not re-invent the wheel

ASP.Net contains something called: User Profiles

They work by storing user preferences and they work for both, anonymous and authenticated users.

When a user is anonymous, his profile is stored in cookies. When the user becomes authenticated, you can migrate the existing anonymous profile to store it in the database.

ASP.Net contains functionality to do all this job for you. You can even access the profile properties using JavaScript

I already answer a couple of questions that can explain the process:

How to persist anon user selection (ex: theme selection)

accessing profile.newproperty in MVC web applications

Note: If you are using a Web Application instead of a Website, then the answer provided in the first link won't work, that's because the Profile class is pre-compiled only when using a Website. In order to implement the profiles functionality, you should create a custom class and inherit from ProfileBase. You can use the code specified in the second link, even when that example is made specifically for MVC, the profile class, and the profile registration in the web.config are the same for any Web Application

Community
  • 1
  • 1
Jupaol
  • 21,107
  • 8
  • 68
  • 100
  • I don't use MVC for creating webpage. Some things you say about "Profile" - i dont understand much. Because i built Database and not use Microsoft's database. So, i need your help others ways. tks for ur help much. – aloha Aug 10 '12 at 08:24
0

I think you should add some settings values to your database for each type of setting you want to store. For example, for the list menu, you may have some field that keeps the order of the items as the user ordered them.

Lyubomir Vasilev
  • 3,000
  • 17
  • 24
0

Probably you would need menu table in database and user_menu_order table. While rendering menu you can use user_menu_order table to sort menu items in right order.

id | menu
---------
1 | Home
2 | About



menu_id | user_id | order
----------------
1 | 1 | 1
2 | 1 | 0
srumjant
  • 155
  • 7