Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 !

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
141 views
Welcome To Ask or Share your Answers For Others

1 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...