jquery drag and drop and save state in Database
Hello i work in inettuts jquery plugin for Sortable box and i save the position in cookies but now i w开发者_开发问答ant to save in database(sql server) , C# code ??
Ok
Please go to this Link : link text
i want to save state this Box in Database by C# code
If you do a postback to the server (ie. click a button) you can get the values from the cookies like this:
System.Web.HttpContext.Current.Request.Cookies["CookieName"].Value
Then you use the code from this pdf (Working with databases) to open a connection to the database and save the cookie value there: http://www.learnvisualstudio.net/content/cheats/CS_Language_Basics.pdf
If you want to do it by using AJAX then you need some event on the client-side that is handled by jQuery and do a AJAX post to a ASHX page (Generic Handler) where you can get the post data like this: context.Request["PostDataVariableName"]
Hope it helps! ;)
精彩评论