hello,
as per my knowledge you cab not able to access one view function into another ,so solution is you need to find reason why you are not able to access "App_code folder "
can you please tell me why you are not able to access "App_code" folders classes code?
I haven't free access to website folder. Everytime I must change something on FS, I need to ask for access.
It is a very long and exhausting procedure.
So...the problem is that one of the shared methods must be changed frequently and this method is used by various partials.
I would find a way to simplify the future modification of this method.
This is a very symple one.
This function associate a color to a specific css class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Newtonsoft.Json.Linq;
using Umbraco.Web;
using Umbraco.Core.Models;
using USN.UrlPicker.Umbraco.Models;
namespace CustomLogic
{
public static class CustomHelper
{
public static string NormalizeColorName(string color)
{
switch (color.ToUpper())
{
case "000000":
color = "cssClassBlack";
break;
case "EE395C":
color = "cssClassRed";
break;
case "728EA4":
color = "cssClassGrey";
break;
case "94BCE2":
color = "cssClassCyan";
break;
case "4AC3D9":
color = "cssClassAcqua";
break;
case "FAAC04":
color = "cssClassOrange";
break;
case "9FD74E":
color = "cssClassGreen";
break;
case "177CCA":
color = "cssClassBlu";
break;
default:
color = "default";
break;
}
return color;
}
}
}
This is a very simple method but there are more complex methods I need to share.
I think I'd solve it with helper methods, but if you are saying you don't have free access to the website/can't add helper methods I'm not sure you can share those :-/
Maybe you can look into aggregating at least some of the partials? Making it more generic so you merge two or more partials together?
That'll depends by what exactly the page does, I'm just saying there could be the case when 2 templates or partials are very similar and they can be made into one!
How to share functions between partial views
Hi to all, I need to create a partial view (macro?) that must have only functions to use in other partial views. For Example:
I tried with:
But when I try to use a function, I receive this error:
I need to use this method because I haven't access to the App_Code folder. Can anyone help me?
hello, as per my knowledge you cab not able to access one view function into another ,so solution is you need to find reason why you are not able to access "App_code folder "
can you please tell me why you are not able to access "App_code" folders classes code?
so i will help you solve problem
I haven't free access to website folder. Everytime I must change something on FS, I need to ask for access. It is a very long and exhausting procedure.
So...the problem is that one of the shared methods must be changed frequently and this method is used by various partials. I would find a way to simplify the future modification of this method.
I hope I was clear Adriano
can you please tell me what kind of method you want to use in different different partial views so can you help you in that ?
This is a very symple one. This function associate a color to a specific css class:
This is a very simple method but there are more complex methods I need to share.
Hi Adriano
I know that this is little bit weird suggestion but what if you will upload changes to web-site via Umbraco packages?
Just create a new package, and needed dll, publish at Umbraco Package Repository and use it in your site via Umbraco admin part.
Is it a solution of your problem?
Thanks,
Alex
Hi Adriano
Did you find a way to do it?
Was it solved ? Can you share please?
Thanks,
Alex
I think I'd solve it with helper methods, but if you are saying you don't have free access to the website/can't add helper methods I'm not sure you can share those :-/
Maybe you can look into aggregating at least some of the partials? Making it more generic so you merge two or more partials together?
Hi Stefano
Can you show how to aggregate some of the partials?
That'll depends by what exactly the page does, I'm just saying there could be the case when 2 templates or partials are very similar and they can be made into one!
is working on a reply...