Technical support This forum is closed.
Version 1.x > Technical support > cmseditableRegion View modes: 
User avatar
Member
Member
malaqui - 5/3/2006 6:09:03 PM
   
cmseditableRegion
Hi,
I need to recover the text that the user wrotes in this editable region. The property value does not work, it is return a null.
What is the property to get the text?
Regards

User avatar
Guest
admin - 5/5/2006 8:14:50 AM
   
Re: cmseditableRegion
Hello,

could you please post here the code you are using?

Thank you.

Best Regards,

User avatar
Member
Member
malaqui - 5/5/2006 10:30:46 AM
   
Re: cmseditableRegion
Hello Peter,
The page has 2 CMSEditableRegions.I want to recover the text of one of them to include its text in an email.

HTML code:


<%@ Register TagPrefix="cc1" Namespace="Kentico.CMS.CMSControls" Assembly="Kentico.CMS.CMSControls" %>
<html>
<head>
....
</head>
<body>

...

<cc1:cmseditableregion id="CMSEditableRegion2" runat="server" DialogHeight="1" DialogWidth="50" RegionType="TextBox" RegionTitle="Título de la página"></cc1:cmseditableregion>

<cc1:cmseditableregion id="CMSEditableRegion1" runat="server" DialogHeight="400" DialogWidth="500" RegionType="HtmlEditor" RegionTitle="Pregunta"></cc1:cmseditableregion>

...

</body>
</html>


C# code


protected Kentico.CMS.CMSControls.CMSEditableRegion CMSEditableRegion2;
protected Kentico.CMS.CMSControls.CMSEditableRegion CMSEditableRegion1;

....


private void BotEnviar_Click(object sender, System.EventArgs e)
{
SmtpMail.SmtpServer = ConfigurationSettings.AppSettings["CMSSMTPServer"];

System.Web.Mail.MailMessage msg = new System.Web.Mail.MailMessage();
msg.BodyFormat = MailFormat.Html;
msg.From = "Anonimo";
msg.To = ConfigurationSettings.AppSettings["Opinion.Receptor"];
msg.Subject = "Premiamos su opinión";
msg.Body = "<b>" + "PREGUNTA:" + "</b>" + "<br>" +
CMSEditableRegion1.Value + "<br>" +
"<b>" + "RESPUESTA:" + "</b>" + "<br>" +
txtMensaje.Text + "<br>" ;
SmtpMail.Send(msg);
}


I have created the template and the web page in the Kentico Administration Interface.

When I execute the code, mValue has the text that I have inserted in the CMSEditableRegion, but CMSEditableRegion1.Value is "". And I can´t recover the text. In the first time I thought that the problem that the type HTmlEditor of the CMSEditableRegion Control. But I have tried to recover the text of the TextBox CMSEditableRegion and I have the same problem. What is the wrong thing?

Regards

User avatar
Guest
admin - 5/5/2006 4:27:12 PM
   
Re: cmseditableRegion
Hello,

this is most likely caused by the fact that the value is not loaded to the CMSEditableRegion control at the time when you're trying to read it.

You can try one of the following solutions:

1) Try to set the CMSEditableRegion.EnableViewState to true.

or

2) Use method Functions.GetEditableRegionText like this:
string myText = Functions.GetEditableRegionText(Functions.GetAliasPath(), "GetEditableRegionText");

Best Regards,