November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="CustomUserAttributes.ascx.cs" Inherits="development.CustomUserAttributes" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
Ett test!!
Funkar?
public void LoadSettings(EPiServer.DataAbstraction.Sid sid, EPiServer.Personalization.PersonalizedData data)
{
if (IsPostBack)
return;
if (data["MySetting"] != null)
{
txtSidSetting.Text = data["MySetting"].ToString();
}
}
public void SaveSettings(EPiServer.DataAbstraction.Sid sid, EPiServer.Personalization.PersonalizedData data)
{
data["MySetting"] = txtSidSetting.Text;
}
So to Editmode, which is a little more tricy. The tricky part is that when you click My Settings and when you click on Save a postback is executed. One time you need the value, the other time, you don't want the value. This is one way to do the logic. I'll ask ElektroPost if there is a better way.
public void LoadSettings(EPiServer.DataAbstraction.Sid sid, EPiServer.Personalization.PersonalizedData data)
{
if (txtSidSetting.Text.Length == 0 )
{
txtSidSetting.Text = data["MySetting"].ToString();
}
}
public void SaveSettings(EPiServer.DataAbstraction.Sid sid, EPiServer.Personalization.PersonalizedData data)
{
data["MySetting"] = txtSidSetting.Text;
}
/Øyvind
public void LoadSettings(Sid sid,PersonalizedData data)
{
if(!IsPostBack)
{
if(data["TestAttribute"] != null)
test.Text = data["TestAttribute"].ToString();
}
}
public void SaveSettings(Sid sid,PersonalizedData data)
{
data["TestAttribute"] = test.Text;
}
If my code starts to fail me I'll use yours...
Best regards, Tony H
[EPiServer.PlugIn.GuiPlugIn(DisplayName="More...", Description="More attributes for Extranetusers", Area=PlugInArea.SidSettingsArea, Url="~/CustomUserAttributes.ascx")] public class CustomUserAttributes : System.Web.UI.UserControl, ISidSettings { protected TextBox test; private void Page_Load(object sender, System.EventArgs e) { if(!IsPostBack) { DataBind(); } } public void LoadSettings(Sid sid,PersonalizedData data) { if(data["TestAttribute"] != null) test.Text = data["TestAttribute"].ToString(); else test.Text = ""; // Empty } public void SaveSettings(Sid sid,PersonalizedData data) { data["TestAttribute"] = test.Text; data.Save(); } ...