本文整理汇总了C#中System.Web.Mvc.AjaxHelper类的典型用法代码示例。如果您正苦于以下问题:C# AjaxHelper类的具体用法?C# AjaxHelper怎么用?C# AjaxHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AjaxHelper类属于System.Web.Mvc命名空间,在下文中一共展示了AjaxHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PagerBuilder
//Ajax pager builder
internal PagerBuilder(AjaxHelper ajaxHelper, int totalPageCount, int pageIndex, PagerOptions pagerOptions,
MvcAjaxOptions ajaxOptions)
{
_ajaxPagingEnabled =true;
if (ajaxHelper == null)
{
throw new ArgumentNullException("ajaxHelper");
}
if (pagerOptions == null)
pagerOptions = new PagerOptions();
_ajax = ajaxHelper;
if (pagerOptions.MaximumPageNumber == 0 || pagerOptions.MaximumPageNumber > totalPageCount)
_totalPageCount = totalPageCount;
else
_totalPageCount = pagerOptions.MaximumPageNumber;
_pageIndex = pageIndex;
_pagerOptions = pagerOptions;
_ajaxOptions = ajaxOptions ?? new MvcAjaxOptions();
// start page index
_startPageIndex = pageIndex - (pagerOptions.NumericPagerItemCount / 2);
if (_startPageIndex + pagerOptions.NumericPagerItemCount > _totalPageCount)
_startPageIndex = _totalPageCount + 1 - pagerOptions.NumericPagerItemCount;
if (_startPageIndex < 1)
_startPageIndex = 1;
// end page index
_endPageIndex = _startPageIndex + _pagerOptions.NumericPagerItemCount - 1;
if (_endPageIndex > _totalPageCount)
_endPageIndex = _totalPageCount;
}
示例2: PagerBuilder
internal PagerBuilder(HtmlHelper html, AjaxHelper ajax, string actionName, string controllerName,
int totalPageCount, int pageIndex, PagerOptions pagerOptions, string routeName, RouteValueDictionary routeValues,
MvcAjaxOptions ajaxOptions, IDictionary<string, object> htmlAttributes)
{
_ajaxPagingEnabled = (ajax != null);
if (pagerOptions == null)
pagerOptions = new PagerOptions();
_html = html;
_ajax = ajax;
_actionName = actionName;
_controllerName = controllerName;
if (pagerOptions.MaxPageIndex == 0 || pagerOptions.MaxPageIndex > totalPageCount)
_totalPageCount = totalPageCount;
else
_totalPageCount = pagerOptions.MaxPageIndex;
_pageIndex = pageIndex;
_pagerOptions = pagerOptions;
_routeName = routeName;
_routeValues = routeValues;
_ajaxOptions = ajaxOptions;
_htmlAttributes = htmlAttributes;
// start page index
_startPageIndex = pageIndex - (pagerOptions.NumericPagerItemCount / 2);
if (_startPageIndex + pagerOptions.NumericPagerItemCount > _totalPageCount)
_startPageIndex = _totalPageCount + 1 - pagerOptions.NumericPagerItemCount;
if (_startPageIndex < 1)
_startPageIndex = 1;
// end page index
_endPageIndex = _startPageIndex + _pagerOptions.NumericPagerItemCount - 1;
if (_endPageIndex > _totalPageCount)
_endPageIndex = _totalPageCount;
}
示例3: PagerBuilder
internal PagerBuilder(AjaxHelper helper, string actionName, string controllerName, int totalPageCount, int pageIndex, PagerOptions options, AjaxOptions ajaxOptions, object values)
{
// Set defaults
if (String.IsNullOrEmpty(actionName))
actionName = (string)helper.ViewContext.RouteData.Values["action"];
if (String.IsNullOrEmpty(controllerName))
controllerName = (string)helper.ViewContext.RouteData.Values["controller"];
if (options == null)
options = new PagerOptions();
// Assign to fields
_helper = helper;
_actionName = actionName;
_controllerName = controllerName;
_totalPageCount = totalPageCount;
_pageIndex = pageIndex;
_options = options;
_values = values;
_ajaxOptions = ajaxOptions;
// Calculate start page index
_startPageIndex = pageIndex - (options.MaximumPageNumbers / 2);
if (_startPageIndex + options.MaximumPageNumbers > _totalPageCount)
_startPageIndex = _totalPageCount - options.MaximumPageNumbers;
if (_startPageIndex < 0)
_startPageIndex = 0;
// Calculate end page index
_endPageIndex = _startPageIndex + _options.MaximumPageNumbers;
if (_endPageIndex > _totalPageCount)
_endPageIndex = _totalPageCount;
}
示例4: GroupBox
public GroupBox(AjaxHelper ajax, string headerText, string loader)
{
_ajax = ajax;
if (IsAjax)
return;
_groupDiv = new TagBuilder("div");
var headerDiv = new TagBuilder("div");
_contentDiv = new TagBuilder("div");
_loadingDiv = new TagBuilder("div");
_groupDiv.AddCssClass("card");
headerDiv.AddCssClass("card-header");
_contentDiv.AddCssClass("card-block");
_contentDiv.Attributes.Add("style", "position:relative;");
_loadingDiv.AddCssClass("ajax-overlay");
_loadingDiv.GenerateId(loader);
headerDiv.SetInnerText(headerText);
Write(_groupDiv.ToString(TagRenderMode.StartTag));
Write(headerDiv.ToString());
Write(_contentDiv.ToString(TagRenderMode.StartTag));
}
示例5: BootstrapActionLink
public BootstrapActionLink(AjaxHelper ajax, string linkText, ActionResult result, AjaxOptions ajaxOptions)
{
this.ajax = ajax;
this._linkText = linkText;
this._result = result;
this._ajaxOptions = ajaxOptions;
this._actionTypePassed = ActionTypePassed.AjaxActionResult;
}
示例6: InitHelpers
public override void InitHelpers()
{
Ajax = new AjaxHelper<object>(ViewContext, this);
Html = new DnnHtmlHelper<object>(ViewContext, this);
Url = new DnnUrlHelper(ViewContext);
Dnn = new DnnHelper<object>(ViewContext, this);
ConferenceModuleContext = new ContextHelper(ViewContext);
}
示例7: AjaxPager
public AjaxPager(AjaxHelper helper, ViewContext viewContext, Options options, AjaxOptions ajaxOptions, RouteValueDictionary valueDictionary)
{
this.ajaxHelper = helper;
this.viewContext = viewContext;
this.options = options;
this.ajaxOptions = ajaxOptions;
this.linkWithoutPageValuesDictionary = valueDictionary;
}
示例8: ConstructorWithNullViewDataContainerThrows
public void ConstructorWithNullViewDataContainerThrows() {
// Assert
ExceptionHelper.ExpectArgumentNullException(
delegate {
AjaxHelper ajaxHelper = new AjaxHelper(new Mock<ViewContext>().Object, null);
},
"viewDataContainer");
}
示例9: AjaxPager
///<include file='MvcPagerDocs.xml' path='MvcPagerDocs/AjaxPager/Constructor[@name="AjaxPager1"]/*'/>
public AjaxPager(AjaxHelper ajax, int totalItemCount, int pageSize, int pageIndex,PagerOptions pagerOptions, MvcAjaxOptions ajaxOptions)
{
_ajaxHelper = ajax;
_totalItemCount = totalItemCount;
_pageSize = pageSize;
_currentPageIndex = pageIndex;
_pagerOptions = pagerOptions;
_ajaxOptions = ajaxOptions;
}
示例10: PagerBuilder
/// <summary>
/// 适用于PagedList为null时
/// </summary>
internal PagerBuilder(HtmlHelper html, AjaxHelper ajax, PagerOptions pagerOptions, IDictionary<string, object> htmlAttributes)
{
if (pagerOptions == null)
pagerOptions = new PagerOptions();
_html = html;
_ajax = ajax;
_pagerOptions = pagerOptions;
_htmlAttributes = htmlAttributes;
}
示例11: DeleteLink
public static MvcHtmlString DeleteLink(AjaxHelper ajaxHelper, string linkText, string actionName, object routeValues)
{
return ajaxHelper.ActionLink(linkText, actionName, routeValues, new AjaxOptions
{
Confirm = "Are you sure you want to delete this item?",
HttpMethod = "DELETE",
OnSuccess = "function() { window.location.reload(); }"
});
}
示例12: AjaxPager
public AjaxPager(AjaxHelper helper, ViewContext viewContext, int pageSize, int currentPage, int totalItemCount, AjaxOptions options, RouteValueDictionary valueDictionary)
{
this.ajaxHelper = helper;
this.viewContext = viewContext;
this.pageSize = pageSize;
this.currentPage = currentPage;
this.totalItemCount = totalItemCount;
this.ajaxOptions = options;
this.linkWithoutPageValuesDictionary = valueDictionary;
}
示例13: HtmlHelper
void IBlock.RenderBlock(ViewContext viewContext)
{
ViewData = viewContext.ViewData;
ViewContext = viewContext;
Html = new HtmlHelper(viewContext, this);
Ajax = new AjaxHelper(viewContext, this);
Url = new UrlHelper(viewContext.RequestContext);
RenderBlock();
}
示例14: PagerBuilder
/// <summary>
/// used when PagedList is null
/// </summary>
public PagerBuilder(HtmlHelper htmlHelper, AjaxHelper ajaxHelper, PagerOptions pagerOptions, IDictionary<String, object> htmlAttributes)
{
if (default(PagerOptions) == pagerOptions) pagerOptions = new PagerOptions();
_msAjaxPaging = (default(AjaxHelper) != ajaxHelper);
_htmlHelper = htmlHelper;
_ajaxHelper = ajaxHelper;
_pagerOptions = pagerOptions;
_htmlAttributes = htmlAttributes;
}
示例15: ComposeImageActionLink
private static MvcHtmlString ComposeImageActionLink(AjaxHelper helper, string imageUrl, string altText,
string actionName, string controllerName, object routeValues,
AjaxOptions ajaxOptions, object htmlAttributes = null)
{
var builder = new TagBuilder("img");
builder.MergeAttribute("src", imageUrl);
builder.MergeAttribute("alt", altText);
string link =
helper.ActionLink("[replaceme]", actionName, controllerName, routeValues, ajaxOptions, htmlAttributes).ToHtmlString();
return new MvcHtmlString(link.Replace("[replaceme]", builder.ToString(TagRenderMode.SelfClosing)));
}