Exception when I add new News item
I'm using v4.0. I added 4 news items with no problem. I noticed I had no way to set the publish date so they all got out of order from my original site's news. So I updated the Created and Last Modified dates in the database. The order is now the way I want it.
So I attempt to go add a new item and get the following exception:
Hello Chris Joyce,
About precise setting of the published date - you can use the Schedule Publish/Unpublish Dialog in the More Actions Menu.
About the js error that your receive - do you use some third party controls in Sitefinity or have you copied some additional assemblies in the bin folder. Is this happening on a fresh installation from Project Manager?
Best wishes,
Nikolay Datchev
the Telerik team
hi,
after upgrading my project to 4.1 i get this:
Server Error in '/IDS' Application.
Parser Error
Description:
An error occurred during the parsing of a resource required to service this
request. Please review the following specific parse error details and modify
your source file appropriately.
Parser Error Message: Unable to
generate code for a value of type 'System.Object'. This error occurred while
trying to generate the property value for Value.
Source Error:
[No relevant source lines]
Source
File:
/IDS/SfCtrlPresentation/OpenAccessDataProvider,fba962d3a8dd4e5d836fc3b616d6f946.ascx
Line: 1
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET
Version:4.0.30319.1
when i try to view a news item.
thanks,
andrei
Hi Andrei,
This sounds like some incompatibility of a customized ascx template and the .NET ASP.NET builder. Can you send us the markup of the template that you use - i guess it is customized database stored widget template for some of the public widgets- NewsView?
Regards,
Nikolay Datchev
the Telerik team
Nikolay,
You are right, it was a customized template to display a single news item. It worked perfectly in 4.0.
Once I have updated, it went wrong. I have messed about with the template since then and hence cannot
give you an exact copy. I am rebuilding it again from scratch with the latest internal build applied. Please
stay subscribed to this forum in case I have issues.
However, for now, one issue still remains. In the back-end template where news items are created, I get
some errors. See the attached image for details. All I did was to change the Label of the fields and the description.
Many thanks,
Andrei
Hello Andrei,
1) About the Resource problem. The error that you receive is related to a change in how we interpret localized labels in UI definitions. The way it was done was wrong, and now you should set resource key , rather than resource value. For example in a typical text field defintion:
var lastNameField = new TextFieldDefinitionElement(mainSection.Fields)
ID = "lastNameFieldControl",
DataFieldName = "Title",
DisplayMode = displayMode,
Title = Res.Get<SomeResources>().LastName,
should be changed to
var lastNameField = new TextFieldDefinitionElement(mainSection.Fields)
ID = "lastNameFieldControl",
DataFieldName = "Title",
DisplayMode = displayMode,
Title = "LastName",
If you don't need summary than you have to remove the code for the summary text field.
About hiding the url panel - generally if your item needs to have a public url - it makes sense to keep this panel so users can customize the public url - if not you can probably use the CssClass property on the section level with some class that has display:none style.
Greetings,
Nikolay,
Thanks for your reply. I must say though, I did nothing in code. All I did was to go to "
Nikolay,
Hi again. Ok, I am getting the following error:
Server Error in '/IDS' Application.
Databinding methods such as Eval(), XPath(), and Bind() can only be used
in the context of a databound control.
Description:
An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and
where it originated in the code.
Exception Details:
System.InvalidOperationException: Databinding methods such as Eval(),
XPath(), and Bind() can only be used in the context of a databound
control.
Source Error:
The source code that generated this unhandled exception can only be
shown when compiled in debug mode. To enable this, please follow one of the
below steps, then request the URL:
1. Add a "Debug=true" directive at the
top of the file that generated the error. Example:
<%@ Page
Language="C#" Debug="true" %>
or:
2) Add the following section
to the configuration file of your
application:
<configuration>
<system.web>
<compilation
debug="true"/>
</system.web>
</configuration>
Note
that this second technique will cause all files within a given application to be
compiled in debug mode. The first technique will cause only that particular file
to be compiled in debug mode.
Important: Running applications in debug
mode does incur a memory/performance overhead. You should make sure that an
application has debugging disabled before deploying into production
scenario.
Stack Trace:
[InvalidOperationException: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.]
System.Web.UI.Page.GetDataItem() +99
System.Web.UI.TemplateControl.Eval(String expression) +36
ASP.sfctrlpresentation_openaccessdataprovider_01c3ff8d06a84ea1ae6952d26e4e801f_ascx.__DataBinding__control5(Object sender, EventArgs e) in C:\Program Files\Telerik\Sitefinity 4.0\Projects\IDS\SfCtrlPresentation\OpenAccessDataProvider,01c3ff8d06a84ea1ae6952d26e4e801f.ascx:23
System.Web.UI.Control.OnDataBinding(EventArgs e) +65
System.Web.UI.WebControls.CompositeControl.DataBind() +21
System.Web.UI.Control.DataBindChildren() +187
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +157
System.Web.UI.Control.DataBind() +15
Telerik.Web.UI.RadListView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +599
Telerik.Web.UI.RadListView.PerformDataBinding(IEnumerable data) +90
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +118
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +29
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +133
Telerik.Web.UI.RadListView.PerformSelect() +24
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +72
Telerik.Web.UI.RadListView.DataBind() +17
Telerik.Web.UI.RadListView.AutoDataBind(RadListViewRebindReason rebindReason) +147
Telerik.Web.UI.RadListView.OnLoad(EventArgs e) +181
System.Web.UI.Control.LoadRecursive() +98
System.Web.UI.Control.LoadRecursive() +168
System.Web.UI.Control.LoadRecursive() +168
System.Web.UI.Control.AddedControl(Control control, Int32 index) +519
System.Web.UI.ControlCollection.Add(Control child) +150
Telerik.Sitefinity.Web.UI.ContentUI.Views.Backend.ViewBase.CreateChildControls() +100
System.Web.UI.Control.EnsureChildControls() +122
System.Web.UI.Control.PreRenderRecursiveInternal() +49
System.Web.UI.Control.PreRenderRecursiveInternal() +204
System.Web.UI.Control.PreRenderRecursiveInternal() +204
System.Web.UI.Control.PreRenderRecursiveInternal() +204
System.Web.UI.Control.PreRenderRecursiveInternal() +204
System.Web.UI.Control.PreRenderRecursiveInternal() +204
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6878
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET
Version:4.0.30319.1
With the following template:
<%@ Control Language="C#" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.ContentUI" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit" Assembly="Telerik.Sitefinity" %>
<
telerik:RadListView
ID
=
"DetailsView"
ItemPlaceholderID
=
"ItemContainer"
AllowPaging
=
"False"
runat
=
"server"
EnableEmbeddedSkins
=
"false"
EnableEmbeddedBaseStylesheet
=
"false"
>
<
LayoutTemplate
>
<
div
class
=
"sfnewsDetails"
>
<
div
class
=
"sfnewsLinksWrp"
>
<
sf:MasterViewHyperLink
class
=
"sfnewsBack"
Font-Size
=
"20px"
Text="<%$ Resources:NewsResources, AllNews %>" runat="server" />
</
div
>
<
div
>
<
table
style
=
"width:100%;text-align:left;font-size:x-large;border-top:1px solid Black;border-bottom:1px solid Black;"
>
<
tr
>
<
td
colspan
=
"2"
style
=
"font-weight:bold;"
>Text</
td
>
</
tr
>
<
tr
>
<
td
style
=
"font-weight:bold;"
>Some more text</
td
>
<
td
>
<
asp:Literal
Text
=
"Staff Notice: "
runat
=
"server"
/>
<
sitefinity:TextField
runat
=
"server"
DisplayMode
=
"Read"
Value='<%# Eval("ReferenceCode")%>' />
</
td
>
</
tr
>
<
tr
>
<
td
>Quite a bit of text here</
td
>
<
td
>
<
asp:Literal
Text
=
"Issued: "
runat
=
"server"
/>
<
sf:FieldListView
ID
=
"PublicationDate1"
runat
=
"server"
Format
=
"PublicationDate.ToLocal():dd MMM yyyy"
/>
</
td
>
</
tr
>
</
table
>
</
div
>
<
asp:PlaceHolder
ID
=
"ItemContainer"
runat
=
"server"
/>
</
div
>
</
LayoutTemplate
>
<
ItemTemplate
>
<
h1
class
=
"sfnewsTitle"
>
<
asp:Literal
Text='<%# Eval("Title") %>' runat="server" />
</
h1
>
<
div
style
=
"font-size:medium;"
>
<
asp:Literal
ID
=
"Literal1"
Text='<%# Eval("Content") %>' runat="server" />
</
div
>
<
div
style
=
"font-size:large;"
>
<
asp:Literal
ID
=
"signatureLine"
Text
=
'_______________________________'
runat
=
"server"
/>
<
sitefinity:TextField
runat
=
"server"
DisplayMode
=
"Read"
Value='<%# Eval("Author")%>' />
<
sitefinity:TextField
runat
=
"server"
DisplayMode
=
"Read"
Value='<%# Eval("SourceName")%>' />
<
sf:FieldListView
ID
=
"PublicationDate"
runat
=
"server"
Format
=
"PublicationDate.ToLocal():dd MMM yyyy"
/>
</
div
>
</
ItemTemplate
>
</
telerik:RadListView
>
Nikolay,
Do not worry, I have sorted it out. I was adding my mark-up in the header it seems.
I have gone into Administration -> Interface Labels & Messages and changed all
the labels and descriptions from there and it looks fine now.
Now, everything from The news side seems to work fine.
Many thanks,
Andrei
Last question,
Can I add code in some way to a single news item template. I want to note in the database
who has viewed an item. Since the page on which the item is viewed is auto-generated, I can not
drop any code on it. So the other way I was thinking was to add some code to the template
or a reference to a ASCX control which would be loaded and the code within it, executed.
Any thoughts / recommendations?
Many thanks,
Andrei
Hello Andrei,
Please check this forum thread.
All the best,
Ivan Dimitrov
the Telerik team