本文整理汇总了C#中AjaxOptions类的典型用法代码示例。如果您正苦于以下问题:C# AjaxOptions类的具体用法?C# AjaxOptions怎么用?C# AjaxOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AjaxOptions类属于命名空间,在下文中一共展示了AjaxOptions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnSuccessProperty
public void OnSuccessProperty() {
// Arrange
AjaxOptions options = new AjaxOptions();
// Act & Assert
MemberHelper.TestStringProperty(options, "OnSuccess", String.Empty, false, true);
}
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:7,代码来源:AjaxOptionsTest.cs
示例2: InsertionModeProperty
public void InsertionModeProperty() {
// Arrange
AjaxOptions options = new AjaxOptions();
// Act & Assert
MemberHelper.TestEnumProperty(options, "InsertionMode", InsertionMode.Replace, false);
}
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:7,代码来源:AjaxOptionsTest.cs
示例3: OnFailureProperty
public void OnFailureProperty() {
// Arrange
AjaxOptions options = new AjaxOptions();
// Act & Assert
MemberHelper.TestStringProperty(options, "OnFailure", String.Empty);
}
开发者ID:adrianvallejo,项目名称:MVC3_Source,代码行数:7,代码来源:AjaxOptionsTest.cs
示例4: HttpMethodProperty
public void HttpMethodProperty() {
// Arrange
AjaxOptions options = new AjaxOptions();
// Act & Assert
MemberHelper.TestStringProperty(options, "HttpMethod", String.Empty, false, true);
}
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:7,代码来源:AjaxOptionsTest.cs
示例5: InsertionModePropertyExceptionText
public void InsertionModePropertyExceptionText()
{
// Arrange
AjaxOptions options = new AjaxOptions();
// Act & Assert
Assert.ThrowsArgumentOutOfRange(
delegate { options.InsertionMode = (InsertionMode)4; },
"value",
@"Specified argument was out of the range of valid values.");
}
开发者ID:tlycken,项目名称:aspnetwebstack,代码行数:11,代码来源:AjaxOptionsTest.cs
示例6: InsertionModeUnobtrusiveTests
public void InsertionModeUnobtrusiveTests(InsertionMode mode, string expected)
{
// Arrange
AjaxOptions options = new AjaxOptions { InsertionMode = mode };
// Act
string result = options.InsertionModeUnobtrusive;
// Assert
Assert.Equal(expected, result);
}
开发者ID:ahmetgoktas,项目名称:aspnetwebstack,代码行数:11,代码来源:AjaxOptionsTest.cs
示例7: ActionLinkAnonymousValues
public void ActionLinkAnonymousValues() {
// Arrange
AjaxHelper helper = GetAjaxHelper();
object values = new { controller = "Controller" };
AjaxOptions options = new AjaxOptions { UpdateTargetId = "update-div" };
// Act
string actionLink = helper.ActionLink("Some Text", "Action", values, options);
// Assert
Assert.AreEqual(@"<a href=""" + HtmlHelperTest.AppPathModifier + @"/app/Controller/Action"" onclick=""Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, updateTargetId: 'update-div' });"">Some Text</a>", actionLink);
}
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:12,代码来源:AjaxExtensionsTest.cs
示例8: InsertionModePropertyExceptionText
public void InsertionModePropertyExceptionText() {
// Arrange
AjaxOptions options = new AjaxOptions();
// Act & Assert
ExceptionHelper.ExpectArgumentOutOfRangeException(
delegate {
options.InsertionMode = (InsertionMode)4;
},
"value",
"The value '4' is outside the valid range of the enumeration type 'System.Web.Mvc.Ajax.InsertionMode'.\r\nParameter name: value");
}
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:12,代码来源:AjaxOptionsTest.cs
示例9: InsertionModePropertyExceptionText
public void InsertionModePropertyExceptionText() {
// Arrange
AjaxOptions options = new AjaxOptions();
// Act & Assert
ExceptionHelper.ExpectArgumentOutOfRangeException(
delegate {
options.InsertionMode = (InsertionMode)4;
},
"value",
@"Specified argument was out of the range of valid values.
Parameter name: value");
}
开发者ID:consumentor,项目名称:Server,代码行数:13,代码来源:AjaxOptionsTest.cs
示例10: DisposeWritesClosingFormTag
public void DisposeWritesClosingFormTag() {
// Arrange
AjaxHelper ajaxHelper = GetAjaxHelper();
AjaxOptions ajaxOptions = new AjaxOptions { UpdateTargetId = "some-id" };
StringWriter writer = new StringWriter();
ajaxHelper.ViewContext.Writer = writer;
// Act
IDisposable form = ajaxHelper.BeginForm("Action", "Controller", ajaxOptions);
form.Dispose();
// Assert
Assert.IsTrue(writer.ToString().EndsWith("</form>"));
}
开发者ID:adrianvallejo,项目名称:MVC3_Source,代码行数:14,代码来源:AjaxExtensionsTest.cs
示例11: PagerBuilder
public PagerBuilder(HtmlHelper htmlHelper, AjaxHelper ajaxHelper, String actionName, String controllerName, int noOfPages, int pageIndex, PagerOptions pagerOptions, String routeName, RouteValueDictionary routeValues, AjaxOptions ajaxOptions, IDictionary<String, object> htmlAttributes)
{
_msAjaxPaging = (default(AjaxHelper) != ajaxHelper);
if (actionName.IsNullOrEmpty())
{
actionName = _msAjaxPaging
? (String) ajaxHelper.ViewContext.RouteData.Values["action"]
: (String) htmlHelper.ViewContext.RouteData.Values["action"];
}
if (controllerName.IsNullOrEmpty())
{
controllerName = _msAjaxPaging
? (String) ajaxHelper.ViewContext.RouteData.Values["controller"]
: (String) htmlHelper.ViewContext.RouteData.Values["controller"];
}
if (null == pagerOptions) pagerOptions = new PagerOptions();
_htmlHelper = htmlHelper;
_ajaxHelper = ajaxHelper;
_actionName = actionName;
_controllerName = controllerName;
_NoOfPages = noOfPages;
_pageIndex = pageIndex;
_pagerOptions = pagerOptions;
_routeName = routeName;
_routeValues = routeValues;
_ajaxOptions = ajaxOptions;
_htmlAttributes = htmlAttributes;
// start page index
_startPageIndex = pageIndex - (pagerOptions.NumericPagerItemCount / 2);
if (_startPageIndex + pagerOptions.NumericPagerItemCount > _NoOfPages)
_startPageIndex = _NoOfPages + 1 - pagerOptions.NumericPagerItemCount;
if (_startPageIndex < 1) _startPageIndex = 1;
// end page index
_endPageIndex = _startPageIndex + _pagerOptions.NumericPagerItemCount - 1;
if (_endPageIndex > _NoOfPages) _endPageIndex = _NoOfPages;
}
开发者ID:erashid,项目名称:Extensions,代码行数:41,代码来源:PagerBuilder.cs
示例12: DisposeWritesClosingFormTag
public void DisposeWritesClosingFormTag() {
// Arrange
Mock<HttpResponseBase> mockResponse = new Mock<HttpResponseBase>(MockBehavior.Strict);
AjaxHelper ajaxHelper = GetAjaxHelper(mockResponse);
AjaxOptions ajaxOptions = new AjaxOptions { UpdateTargetId = "some-id" };
// Arrange expectations
mockResponse.Expect(response => response.Write(AjaxFormWithTargetId)).Verifiable();
mockResponse.Expect(response => response.Write(AjaxFormClose)).Verifiable();
// Act
IDisposable form = ajaxHelper.BeginForm("Action", "Controller", ajaxOptions);
form.Dispose();
// Assert
mockResponse.Verify();
}
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:17,代码来源:AjaxExtensionsTest.cs
示例13: BeginRouteFormTypedValues_Unobtrusive
public void BeginRouteFormTypedValues_Unobtrusive()
{
// Arrange
AjaxHelper ajaxHelper = GetAjaxHelper(unobtrusiveJavaScript: true);
AjaxOptions ajaxOptions = new AjaxOptions();
RouteValueDictionary values = new RouteValueDictionary();
StringWriter writer = new StringWriter();
ajaxHelper.ViewContext.Writer = writer;
// Act
IDisposable form = ajaxHelper.BeginRouteForm("namedroute", values, ajaxOptions);
// Assert
Assert.Equal(@"<form action=""" + MvcHelper.AppPathModifier + @"/app/named/home/oldaction"" data-ajax=""true"" method=""post"">", writer.ToString());
}
开发者ID:haoduotnt,项目名称:aspnetwebstack,代码行数:15,代码来源:AjaxExtensionsTest.cs
示例14: RouteLinkNamedRouteTypedValuesAndAttributes
public void RouteLinkNamedRouteTypedValuesAndAttributes() {
// Arrange
AjaxHelper ajaxHelper = GetAjaxHelper();
RouteValueDictionary values = new RouteValueDictionary {
{ "controller", "Controller" },
{ "action", "Action" }
};
Dictionary<string, object> htmlAttributes = new Dictionary<string, object> { { "foo", "bar" }, { "baz", "quux" } };
AjaxOptions options = new AjaxOptions { UpdateTargetId = "update-div" };
// Act
string actionLink = ajaxHelper.RouteLink("Some Text", "namedroute", values, options, htmlAttributes);
// Assert
Assert.AreEqual(@"<a baz=""quux"" foo=""bar"" href=""" + HtmlHelperTest.AppPathModifier + @"/app/named/Controller/Action"" onclick=""Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, updateTargetId: 'update-div' });"">Some Text</a>", actionLink);
}
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:17,代码来源:AjaxExtensionsTest.cs
示例15: RouteLinkWithHostName
public void RouteLinkWithHostName() {
// Arrange
AjaxHelper ajaxHelper = GetAjaxHelper();
Dictionary<string, object> htmlAttributes = new Dictionary<string, object> { { "foo", "bar" }, { "baz", "quux" } };
AjaxOptions options = new AjaxOptions { UpdateTargetId = "update-div" };
// Act
string actionLink = ajaxHelper.RouteLink("Some Text", "namedroute", null, "baz.bar.foo", null, null, options, htmlAttributes);
// Assert
Assert.AreEqual(@"<a baz=""quux"" foo=""bar"" href=""http://baz.bar.foo" + HtmlHelperTest.AppPathModifier + @"/app/named/home/oldaction"" onclick=""Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, updateTargetId: 'update-div' });"">Some Text</a>", actionLink);
}
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:12,代码来源:AjaxExtensionsTest.cs
示例16: ActionLinkControllerTypedValues_Unobtrusive
public void ActionLinkControllerTypedValues_Unobtrusive()
{
// Arrange
AjaxHelper helper = GetAjaxHelper(unobtrusiveJavaScript: true);
RouteValueDictionary values = new RouteValueDictionary
{
{ "id", 5 }
};
AjaxOptions options = new AjaxOptions { UpdateTargetId = "update-div" };
// Act
MvcHtmlString actionLink = helper.ActionLink("Some Text", "Action", "Controller", values, options);
// Assert
Assert.Equal(@"<a data-ajax=""true"" data-ajax-mode=""replace"" data-ajax-update=""#update-div"" href=""" + MvcHelper.AppPathModifier + @"/app/Controller/Action/5"">Some Text</a>", actionLink.ToHtmlString());
}
开发者ID:haoduotnt,项目名称:aspnetwebstack,代码行数:16,代码来源:AjaxExtensionsTest.cs
示例17: RouteLinkNamedRouteAnonymousAttributes
public void RouteLinkNamedRouteAnonymousAttributes() {
// Arrange
AjaxHelper ajaxHelper = GetAjaxHelper();
object htmlAttributes = new {
foo = "bar",
baz = "quux"
};
AjaxOptions options = new AjaxOptions { UpdateTargetId = "update-div" };
// Act
string actionLink = ajaxHelper.RouteLink("Some Text", "namedroute", options, htmlAttributes);
// Assert
Assert.AreEqual(@"<a baz=""quux"" foo=""bar"" href=""" + HtmlHelperTest.AppPathModifier + @"/app/named/home/oldaction"" onclick=""Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, updateTargetId: 'update-div' });"">Some Text</a>", actionLink);
}
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:15,代码来源:AjaxExtensionsTest.cs
示例18: RouteLinkNamedRouteTypedAttributes
public void RouteLinkNamedRouteTypedAttributes()
{
// Arrange
AjaxHelper ajaxHelper = GetAjaxHelper(unobtrusiveJavaScript: false);
Dictionary<string, object> htmlAttributes = new Dictionary<string, object> { { "foo", "bar" }, { "baz", "quux" }, { "foo_bar", "baz_quux" } };
AjaxOptions options = new AjaxOptions { UpdateTargetId = "update-div" };
// Act
MvcHtmlString actionLink = ajaxHelper.RouteLink("Some Text", "namedroute", options, htmlAttributes);
// Assert
Assert.Equal(@"<a baz=""quux"" foo=""bar"" foo_bar=""baz_quux"" href=""" + MvcHelper.AppPathModifier + @"/app/named/home/oldaction"" onclick=""Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, updateTargetId: 'update-div' });"">Some Text</a>", actionLink.ToHtmlString());
}
开发者ID:haoduotnt,项目名称:aspnetwebstack,代码行数:13,代码来源:AjaxExtensionsTest.cs
示例19: RouteLinkTypedValues
public void RouteLinkTypedValues()
{
// Arrange
AjaxHelper helper = GetAjaxHelper(unobtrusiveJavaScript: false);
RouteValueDictionary values = new RouteValueDictionary
{
{ "controller", "Controller" },
{ "action", "Action" }
};
AjaxOptions options = new AjaxOptions { UpdateTargetId = "update-div" };
// Act
MvcHtmlString actionLink = helper.RouteLink("Some Text", values, options);
// Assert
Assert.Equal(@"<a href=""" + MvcHelper.AppPathModifier + @"/app/Controller/Action"" onclick=""Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, updateTargetId: 'update-div' });"">Some Text</a>", actionLink.ToHtmlString());
}
开发者ID:haoduotnt,项目名称:aspnetwebstack,代码行数:18,代码来源:AjaxExtensionsTest.cs
示例20: RouteLinkTypedValuesAndAttributes_Unobtrusive
public void RouteLinkTypedValuesAndAttributes_Unobtrusive()
{
// Arrange
AjaxHelper helper = GetAjaxHelper(unobtrusiveJavaScript: true);
RouteValueDictionary values = new RouteValueDictionary
{
{ "controller", "Controller" },
{ "action", "Action" }
};
Dictionary<string, object> htmlAttributes = new Dictionary<string, object>
{
{ "foo", "bar" },
{ "baz", "quux" },
{ "foo_bar", "baz_quux" }
};
AjaxOptions options = new AjaxOptions { UpdateTargetId = "update-div" };
// Act
MvcHtmlString actionLink = helper.RouteLink("Some Text", values, options, htmlAttributes);
// Assert
Assert.Equal(@"<a baz=""quux"" data-ajax=""true"" data-ajax-mode=""replace"" data-ajax-update=""#update-div"" foo=""bar"" foo_bar=""baz_quux"" href=""" + MvcHelper.AppPathModifier + @"/app/Controller/Action"">Some Text</a>", actionLink.ToHtmlString());
}
开发者ID:haoduotnt,项目名称:aspnetwebstack,代码行数:23,代码来源:AjaxExtensionsTest.cs
注:本文中的AjaxOptions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论