c# - Check if (partial) view exists from HtmlHelperMethod -


does know if it's possible check if partial view exists within htmlhelperextension?

i know it's possible controller using following:

 private bool viewexists(string name)  {      viewengineresult result = viewengines.engines.findview(controllercontext, name, null);      return (result.view != null);  } 

source: does view exist in asp.net mvc?

but can't above in helper, don't have access controller context. thoughts on how this?

but can't above in helper, don't have access controller context.

oh yes, have access:

public static htmlstring myhelper(this htmlhelper html) {     var controllercontext = html.viewcontext.controller.controllercontext;     var result = viewengines.engines.findview(controllercontext, name, null);     ... } 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -