Custom datatype value does not display upon saving
Hi,
I create a custom datatype for the telephone number that consist of three text box for the country code, area code and phone number.
The problem is I can see that it is saving in the database when I check the cmsPropertyData table. But when I try to load again the content that have that custom data type the textboxes are all empty. I'm not sure what is happening on it.
You don't appear to be actually saving the current document. I suggest you try and instantiate the document first. Usually, something along the lines of the following works:
Custom datatype value does not display upon saving
Hi,
I create a custom datatype for the telephone number that consist of three text box for the country code, area code and phone number.
The problem is I can see that it is saving in the database when I check the cmsPropertyData table. But when I try to load again the content that have that custom data type the textboxes are all empty. I'm not sure what is happening on it.
Here's my code.
You don't appear to be actually saving the current document. I suggest you try and instantiate the document first. Usually, something along the lines of the following works:
protected void MyTextBox_TextChanged(object sender, EventArgs e)
{
int id;
if (!int.TryParse(Request.QueryString["id"], out id) || String.IsNullOrEmpty(MyTextBox .Text))
{
throw new Exception("Invalid Document ID in querystring.");
}
var document = new Document(id);
umbraco.library.UpdateDocumentCache(document.Id);
document.getProperty("myPropertyAlias").Value = MyTextBox.Text;
document.Save();
}
Your example shows you assigning the values, but not persisting them. Umbraco doesn't auto-persist AFAIK.
is working on a reply...