Control Designers, applyChanges, and Saving Data
Okay, so I have my Control View (not designer view), below:
<%@ Control Language="C#" %>First Text Box:<asp:Literal ID="Content1" runat="server"></asp:Literal>Second Text Box:<asp:Literal ID="Content2" runat="server"></asp:Literal><%@ Control Language="C#" %><%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %><%@ Register Assembly="Telerik.Sitefinity" TagPrefix="sitefinity" Namespace="Telerik.Sitefinity.Publishing.Web.UI.Designers" %><%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sitefinity" %><%@ Register Assembly="Telerik.Sitefinity" TagPrefix="sitefinity" Namespace="Telerik.Sitefinity.Modules.Libraries.Web.UI.Designers" %><sitefinity:FormManager id="formManager" runat="server" /><asp:TextBox ID="Content1" runat="server"></asp:TextBox><asp:TextBox ID="Content2" runat="server"></asp:TextBox>private string _content1 = "";public string Content1 get return this._content1; set this._content1 = value; private string _content2 = "";public string Content2 get return this._content2; set this._content2 = value; protected Literal FirstBox get return Container.GetControl<Literal>("Content1", true); protected Literal SecondBox get return Container.GetControl<Literal>("Content2", true); applyChanges: function () this.get_controlData().FirstBox.Text = $(".content1").val(); this.get_controlData().SecondBox.Text = $(".content1").val();,Hello Conrad,
applyChanges is called when you click on the "Save" button of the designer. There are another method - refereshUI that you can use - forces the designer to refresh the UI from the cotnrol Data
All the best,
Ivan Dimitrov
the Telerik team
Ivan,
Thanks for following up. Unfortunately - that wasn't the question I was looking to have answered.
With applyChanges or refreshUI, I want to know if there is a way to directly access control properties (Literal.Text e.g.) instead of having to access a string property that is later assigned to the Literal.Text in my InitializeControls method.
Does this make sense? Just trying to save some code
Thanks again
Hi Conrad Ehinger,
Unfortunately using the approach from your question will not work. You have to pass down the changes to the properties backed by your private fields. The text boxes will not be available in the context of the control data javascript object.
Kind regards,
Radoslav Georgiev
the Telerik team