Signup/Sign In

Answers

All questions must be answered. Here are the Answers given by this user in the Forum.

The Microsoft AJAX library will accomplish this. You could also create your own solution that involves using AJAX to call your own aspx (as basically) script files to run .NET functions.

I suggest the Microsoft AJAX library. Once installed and referenced, you just add a line in your page load or init:
***Ajax.Utility.RegisterTypeForAjax(GetType(YOURPAGECLASSNAME))***

Then you can do things like:
*** _
Public Function Get5() AS Integer
Return 5
End Function***
Then, you can call it on your page as:
***PageClassName.Get5(javascriptCallbackFunction);***

The last parameter of your function call must be the javascript callback function that will be executed when the AJAX request is returned.
4 years ago
Extension:
***public static MvcHtmlString LiActionLink(this HtmlHelper html, string text, string action, string controller)
{
var context = html.ViewContext;
if (context.Controller.ControllerContext.IsChildAction)
context = html.ViewContext.ParentActionViewContext;
var routeValues = context.RouteData.Values;
var currentAction = routeValues["action"].ToString();
var currentController = routeValues["controller"].ToString();

var str = String.Format("
  • {1}
  • ",
    currentAction.Equals(action, StringComparison.InvariantCulture) &&
    currentController.Equals(controller, StringComparison.InvariantCulture) ?
    " class=\"active\"" :
    String.Empty, html.ActionLink(text, action, controller).ToHtmlString()
    );
    return new MvcHtmlString(str);
    }***

    Usage:
    ******
    4 years ago