+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Name propperty of the Library cannot be changed at Runtime

Name propperty of the Library cannot be changed at Runtime

6 posts, 0 answered
  1. ravi shankar
    ravi shankar avatar
    18 posts
    Registered:
    13 Feb 2010
    10 May 2010
    Link to this post
    Hi Sitefinity,

    When I am Removing some Characters from the Name Property of Image/Video Library(Telerik.Libraries.Data.Library) I at runtime am getting the Error as
    You cannot change a value of an object that is not in transaction.
    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: Nolics.ORMapper.Base.NolnetException: You cannot change a value of an object that is not in transaction.
     
    Source Error:
     
     
    Line 119:        {          
    Line 120:            if ((g_list[j] as Telerik.Libraries.Data.Library).Name.Contains("Regular_"))
    Line 121:                (g_list[j] as Telerik.Libraries.Data.Library).Name = (g_list[j] as Telerik.Libraries.Data.Library).Name.Remove(0, 8);
    Line 122:            if ((g_list[j] as Telerik.Libraries.Data.Library).Name.Contains("Journalist_"))
    Line 123:                (g_list[j] as Telerik.Libraries.Data.Library).Name = (g_list[j] as Telerik.Libraries.Data.Library).Name.Remove(0, 11);
      
     
    Source File: c:\Program Files\telerik\Sitefinity3.7\WebSites\FinalQP\UserControls\GI\MyImageView.ascx.cs    Line: 121
     
    Stack Trace:
     
     
    [NolnetException: You cannot change a value of an object that is not in transaction.]
       Nolics.ORMapper.Base.OdbClassHelper.CheckAssign(IOdbView clView, String propertyName, Object oldValue, Object newValue) +182
       Telerik.Libraries.Data.Library.set_Name(String value) +49
       Sitefinity_UserControls_MyImageView_MyImageView.LoadImages() in c:\Program Files\telerik\Sitefinity3.7\WebSites\FinalQP\UserControls\GI\MyImageView.ascx.cs:121
       Sitefinity_UserControls_MyImageView_MyImageView.Page_Load(Object sender, EventArgs e) in c:\Program Files\telerik\Sitefinity3.7\WebSites\FinalQP\UserControls\GI\MyImageView.ascx.cs:80
       System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
       System.Web.UI.Control.OnLoad(EventArgs e) +99
       System.Web.UI.Control.LoadRecursive() +50
       System.Web.UI.Control.AddedControl(Control control, Int32 index) +265
       System.Web.UI.ControlCollection.Add(Control child) +80
       Telerik.Cms.Web.InternalPage.AddPageControls(IPageContent pageContent, Dictionary`2 placeHolders) +412
       Telerik.Cms.Web.InternalPage.CreateChildControls() +656
       System.Web.UI.Control.EnsureChildControls() +87
       System.Web.UI.Control.PreRenderRecursiveInternal() +44
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842



    Since i have to remove the Prefix of the Name property Like "Regular_" etc  and display the name.



  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    10 May 2010
    Link to this post
    Hi ravi shankar,

    1. Work with interfaces - ILibrary instead of with data classes directly.
    2. You need to get the object by using GetLibrary method of the LibraryManager class.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. ravi shankar
    ravi shankar avatar
    18 posts
    Registered:
    13 Feb 2010
    10 May 2010
    Link to this post
    Hi Ivan Dimitrov,

    Even if i use ILibrary i am getting the same error

    You cannot change a value of an object that is not in transaction.
    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: Nolics.ORMapper.Base.NolnetException: You cannot change a value of an object that is not in transaction.
     
    Source Error:
     
     
    Line 119:        {
    Line 120:            ILibrary lib = g_manager.GetLibrary((g_list[j] as Telerik.Libraries.Data.Library).Name);
    Line 121:            lib.Name = "dfsdfsdf";
    Line 122:        }
    Line 123:
      
     
    Source File: c:\Program Files\telerik\Sitefinity3.7\WebSites\FinalQP\UserControls\GI\MyImageView.ascx.cs    Line: 121
     
    Stack Trace:
     
     
    [NolnetException: You cannot change a value of an object that is not in transaction.]
       Nolics.ORMapper.Base.OdbClassHelper.CheckAssign(IOdbView clView, String propertyName, Object oldValue, Object newValue) +182
       Telerik.Libraries.Data.Library.set_Name(String value) +49
       Sitefinity_UserControls_MyImageView_MyImageView.LoadImages() in c:\Program Files\telerik\Sitefinity3.7\WebSites\FinalQP\UserControls\GI\MyImageView.ascx.cs:121
       Sitefinity_UserControls_MyImageView_MyImageView.Page_Load(Object sender, EventArgs e) in c:\Program Files\telerik\Sitefinity3.7\WebSites\FinalQP\UserControls\GI\MyImageView.ascx.cs:80
       System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
       System.Web.UI.Control.OnLoad(EventArgs e) +99
       System.Web.UI.Control.LoadRecursive() +50
       System.Web.UI.Control.AddedControl(Control control, Int32 index) +265
       System.Web.UI.ControlCollection.Add(Control child) +80
       Telerik.Cms.Web.InternalPage.AddPageControls(IPageContent pageContent, Dictionary`2 placeHolders) +412
       Telerik.Cms.Web.InternalPage.CreateChildControls() +656
       System.Web.UI.Control.EnsureChildControls() +87
       System.Web.UI.Control.PreRenderRecursiveInternal() +44
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842



    Below is the Code which i am using :
     for (int j = 0; j < g_list.Count; j++)
            {
                ILibrary lib = g_manager.GetLibrary((g_list[j] as Telerik.Libraries.Data.Library).Name);
                lib.Name = "dfsdfsdf";
            }


    Where g_list conatins Collection of ImageLibrary Items.
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    10 May 2010
    Link to this post
    Hi ravi shankar,

    The bellow code edits the first library in the list of libraries and saves it:
    // create new instance of LibraryManager
    Telerik.Libraries.LibraryManager libraryManager = new Telerik.Libraries.LibraryManager();
    // get all libraries
    IList listOfAllLibraries = libraryManager.GetAllLibraries();
    if (listOfAllLibraries.Count > 0)
    {
        // get first library
        Telerik.Libraries.ILibrary firstLibrary = libraryManager.GetLibrary(((Telerik.Libraries.ILibrary)listOfAllLibraries[0]).ID);
        // save a value for the TypeName property
        firstLibrary.Name = "Edited Name";
        // save the library into the database
        libraryManager.SaveLibrary(firstLibrary);
    }

    The code is similar to the one in our on-line developer manual, you can find it here.

    Best wishes,
    Radoslav Georgiev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Josh
    Josh  avatar
    25 posts
    Registered:
    28 Apr 2009
    17 Sep 2010
    Link to this post

    the provided solution does not work for me.  Here is a snippet of my code.

    LibraryManager lib_manager = new LibraryManager(DEFAULT_LIBRARY_PROVIDER);
    IList listofAllLibraries = lib_manager.GetAllLibraries();
    if (listofAllLibraries.Count > 0)
    {
        ILibrary lib_article = lib_manager.GetLibrary(hf_gallery_name.Value);
          //"not in transaction" error occurs on next line
        lib_article.Name = this.Title.Text;
        lib_manager.SaveLibrary(lib_article);
    }
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    19 Sep 2010
    Link to this post
    Hi Josh ,

    Please use the code block provided in this post.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
6 posts, 0 answered