Pass javascript function name as parameter + Html Helper
<p>I have written html helper which initialize a javascript function.In the javascript function i have unHandledErrorCallback function which will default log the error into console.log.</p>

<pre><code>&lt;script&gt;
   Initializefunction({
        Url: "/xxx/yyyy",
        x: 10,
        y: true,
        somevalue: false,
        unHandledErrorCallback: function (message) {
           console.log("Somerror message " + message);
        }
   });
&lt;/script&gt;
</code></pre>

<p>Html helper would look like as below</p>

<pre><code>    public static MvcHtmlString Initializefunction(this HtmlHelper html, bool x, bool y, string someurl, int maxCount, string handleErrorFunctionName)
    {
        var Element = new TagBuilder("input");
        Element.MergeAttribute("id", "logging");
        Element.MergeAttribute("type", "hidden");            
        Element.MergeAttribute("data-abc-x", x.ToString());
        Element.MergeAttribute("data-abc-y", y.ToString());
        Element.MergeAttribute("data-abc-someurl", someurl);
        Element.MergeAttribute("data-abc-maxcount", maxCount.ToString(CultureInfo.InvariantCulture));
        aicloggingElement.MergeAttribute("data-abc-callbackfunctionname", handleErrorFunctionName);
        return MvcHtmlString.Create(Element.ToString());
    }
</code></pre>

<p>How Do i take the handlerErrorCallback function name from user through html helper and initilise in javascript function.</p>
