ixjngtv

  點部落 :: Home :: Syndication :: 我的收藏 ::  :: Login
  文章數 - 22, 回應數 - 4, 引用數 - 0

每月文章

參考

麻吉

記住使用者上次登入頁面時的選擇,下次載入頁面時即套用

例子:

//是設定UserSetting的值

UserSetting SelectAmount = new UserSetting();
        if (Session["UserID"] != null)
        {
            SelectAmount = UserSetting.GetUserSettingsByUserID(Session["UserID"].ToString()).Find(p => p.Key == "aSelectAmount");
            if (SelectAmount != null)
            {
                SelectAmount.Value = ddlDisplayAmount.SelectedValue;
                SelectAmount.Update();
            }
            else
            {
                SelectAmount = new UserSetting();
                SelectAmount.Value = ddlDisplayAmount.SelectedValue;
                SelectAmount.Key = "QuestionnaireSelectAmount";
                SelectAmount.UserID = Session["UserID"].ToString();
                SelectAmount.Insert();
            }
        }

然後在要使用的地叫出UserSetting的值,如下:

                    UserSetting SelectAmount = new UserSetting();
                    if (Session["UserID"] != null)
                    {
                        SelectAmount = UserSetting.GetUserSettingsByUserID(Session["UserID"].ToString()).Find(p => p.Key == "aSelectAmount");
                        if (SelectAmount != null)
                        {
                            ddlDisplayAmount.SelectedValue = SelectAmount.Value;
                        }
                    }

 


posted on 2008/11/21 10:55 | 我要推薦 | 閱讀數 : 128 | 訂閱

關連文章


Feedback

目前沒有回應.

回應

標題:
姓名:
電子郵件:(將不會被顯示)
個人網頁:
內容: 

登入後使用進階評論
Please add 4 and 3 and type the answer here: