React to the selfclosing support in TagHelpers
This commit is contained in:
parent
e6b75de0af
commit
4bb85eeaeb
|
|
@ -105,7 +105,6 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
{
|
||||
output.MergeAttributes(tagBuilder);
|
||||
output.PostContent += tagBuilder.InnerHtml;
|
||||
output.SelfClosing = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -203,10 +203,9 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
if (tagBuilder != null)
|
||||
{
|
||||
// This TagBuilder contains the one <input/> element of interest. Since this is not the "checkbox"
|
||||
// special-case, output is a self-closing element and can merge the TagBuilder in directly.
|
||||
// special-case, output is a self-closing element no longer guarunteed.
|
||||
output.MergeAttributes(tagBuilder);
|
||||
output.Content += tagBuilder.InnerHtml;
|
||||
output.SelfClosing = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -240,7 +239,6 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
// Do not generate current element's attributes or tags. Instead put both <input type="checkbox"/> and
|
||||
// <input type="hidden"/> into the output's Content.
|
||||
output.Attributes.Clear();
|
||||
output.SelfClosing = false; // Otherwise Content will be ignored.
|
||||
output.TagName = null;
|
||||
|
||||
output.Content += tagBuilder.ToString(TagRenderMode.SelfClosing);
|
||||
|
|
|
|||
|
|
@ -108,7 +108,6 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
{
|
||||
output.MergeAttributes(tagBuilder);
|
||||
output.PostContent += tagBuilder.InnerHtml;
|
||||
output.SelfClosing = false;
|
||||
}
|
||||
|
||||
// Whether or not (not being highly unlikely) we generate anything, could update contained <option/>
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
output.Content = tagBuilder.InnerHtml;
|
||||
|
||||
output.MergeAttributes(tagBuilder);
|
||||
output.SelfClosing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,6 @@
|
|||
</div>
|
||||
<div class="warehouse validation-summary-valid" data-valmsg-summary="true"><ul><li style="display:none"></li>
|
||||
</ul></div>
|
||||
<input type="submit"></input>
|
||||
<input type="submit" />
|
||||
</form></body>
|
||||
</html>
|
||||
|
|
@ -41,7 +41,7 @@ Address_1</textarea>;
|
|||
<input data-val="true" data-val-range="The field Number must be between 1 and 100." data-val-range-max="100" data-val-range-min="1" id="Employee_Number" name="Employee.Number" type="hidden" value="1" />
|
||||
<div class="validation-summary-valid" data-valmsg-summary="true"><ul><li style="display:none"></li>
|
||||
</ul></div>
|
||||
<input type="submit"></input>
|
||||
<input type="submit" />
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<title>Link</title>
|
||||
|
||||
<!-- Plain link tag -->
|
||||
<link href="/site.css" rel="stylesheet"></link>
|
||||
<link href="/site.css" rel="stylesheet" />
|
||||
|
||||
<!-- Globbed link tag with existing file -->
|
||||
<link rel="stylesheet" href="/site.css" />
|
||||
|
|
@ -15,10 +15,10 @@
|
|||
<link rel="stylesheet" href="/site.css" /><link rel="stylesheet" href="/sub/site2.css" />
|
||||
|
||||
<!-- Globbed link tag missing include -->
|
||||
<link rel="stylesheet"></link>
|
||||
<link rel="stylesheet" />
|
||||
|
||||
<!-- Globbed link tag missing include but with static href -->
|
||||
<link href="/site.css" rel="stylesheet"></link>
|
||||
<link href="/site.css" rel="stylesheet" />
|
||||
|
||||
<!-- Globbed link tag with missing file -->
|
||||
|
||||
|
|
@ -66,13 +66,13 @@
|
|||
<link href="/site.min.css" rel="stylesheet" data-extra="test" />
|
||||
|
||||
<!-- Fallback with missing attribute -->
|
||||
<link href="/site.min.css" rel="stylesheet" data-extra="test"></link>
|
||||
<link href="/site.min.css" rel="stylesheet" data-extra="test" />
|
||||
|
||||
<!-- Fallback with missing attribute -->
|
||||
<link href="/site.min.css" rel="stylesheet" data-extra="test"></link>
|
||||
<link href="/site.min.css" rel="stylesheet" data-extra="test" />
|
||||
|
||||
<!-- Fallback with missing attribute -->
|
||||
<link href="/site.min.css" rel="stylesheet" data-extra="test"></link>
|
||||
<link href="/site.min.css" rel="stylesheet" data-extra="test" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@
|
|||
<div class="order validation-summary-valid" data-valmsg-summary="true"><ul><li style="display:none"></li>
|
||||
</ul></div>
|
||||
<input type="hidden" id="Customer_Key" name="Customer.Key" value="KeyA" />
|
||||
<input type="submit"></input>
|
||||
<input type="submit" />
|
||||
<input name="__RequestVerificationToken" type="hidden" value="{0}" /></form>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
<textarea rows="4" cols="50" class="product" id="Description" name="Description">
|
||||
Type the product description</textarea>
|
||||
</div>
|
||||
<input type="submit"></input>
|
||||
<input type="submit" />
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -55,6 +55,6 @@
|
|||
<label class="product" for="z2__Description">Description</label>
|
||||
<textarea rows="4" cols="50" class="product" id="z2__Description" name="[2].Description">
|
||||
Product_2 description</textarea>
|
||||
</div> <input type="submit"></input>
|
||||
</div> <input type="submit" />
|
||||
</form></body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@
|
|||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input class="btn btn-default" type="submit" value="Create"></input>
|
||||
<input class="btn btn-default" type="submit" value="Create" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@
|
|||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input class="btn btn-default" type="submit" value="Create"></input>
|
||||
<input class="btn btn-default" type="submit" value="Create" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"></meta>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"></meta>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>About - My ASP.NET Application</title>
|
||||
|
||||
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
<p><strong>Number of tags to show:</strong> 30</p>
|
||||
</section>
|
||||
</div>
|
||||
<hr></hr>
|
||||
<hr />
|
||||
<footer>
|
||||
|
||||
</footer>
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"></meta>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"></meta>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Help - My ASP.NET Application</title>
|
||||
|
||||
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
<div>
|
||||
<p>Hello, you've reached the help page. If you're having troubles try visiting our <a href="/?approved=true">My Approved Home Page</a></p>
|
||||
</div>
|
||||
<hr></hr>
|
||||
<hr />
|
||||
<footer>
|
||||
|
||||
</footer>
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"></meta>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"></meta>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Home Page - My ASP.NET Application</title>
|
||||
|
||||
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
</div>
|
||||
|
||||
|
||||
<hr></hr>
|
||||
<hr />
|
||||
<footer>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ namespace Asp
|
|||
BeginContext(120, 2, true);
|
||||
WriteLiteral("\r\n");
|
||||
EndContext();
|
||||
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", "test", async() => {
|
||||
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", true, "test", async() => {
|
||||
}
|
||||
, StartWritingScope, EndWritingScope);
|
||||
__Microsoft_AspNet_Mvc_Razor_InputTestTagHelper = CreateTagHelper<Microsoft.AspNet.Mvc.Razor.InputTestTagHelper>();
|
||||
|
|
@ -77,7 +77,7 @@ __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper.For = CreateModelExpression(__mo
|
|||
BeginContext(146, 2, true);
|
||||
WriteLiteral("\r\n");
|
||||
EndContext();
|
||||
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", "test", async() => {
|
||||
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", true, "test", async() => {
|
||||
}
|
||||
, StartWritingScope, EndWritingScope);
|
||||
__Microsoft_AspNet_Mvc_Razor_InputTestTagHelper = CreateTagHelper<Microsoft.AspNet.Mvc.Razor.InputTestTagHelper>();
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
|
||||
// Assert
|
||||
Assert.Equal("form", output.TagName);
|
||||
Assert.False(output.SelfClosing);
|
||||
Assert.Empty(output.Attributes);
|
||||
Assert.Empty(output.PreContent);
|
||||
Assert.Empty(output.Content);
|
||||
|
|
@ -185,6 +186,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
await formTagHelper.ProcessAsync(context, output);
|
||||
|
||||
Assert.Equal("form", output.TagName);
|
||||
Assert.False(output.SelfClosing);
|
||||
var attribute = Assert.Single(output.Attributes);
|
||||
Assert.Equal(expectedAttribute, attribute);
|
||||
Assert.Empty(output.PreContent);
|
||||
|
|
@ -225,6 +227,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
generator.Verify();
|
||||
|
||||
Assert.Equal("form", output.TagName);
|
||||
Assert.False(output.SelfClosing);
|
||||
Assert.Empty(output.Attributes);
|
||||
Assert.Empty(output.PreContent);
|
||||
Assert.Empty(output.Content);
|
||||
|
|
@ -308,6 +311,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
|
||||
// Assert
|
||||
Assert.Equal("form", output.TagName);
|
||||
Assert.False(output.SelfClosing);
|
||||
var attribute = Assert.Single(output.Attributes);
|
||||
Assert.Equal(new KeyValuePair<string, string>("aCTiON", "my-action"), attribute);
|
||||
Assert.Empty(output.PreContent);
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
Assert.Equal(expectedPreContent, output.PreContent);
|
||||
Assert.Equal(expectedContent, output.Content);
|
||||
Assert.Equal(expectedPostContent, output.PostContent);
|
||||
Assert.True(output.SelfClosing);
|
||||
Assert.False(output.SelfClosing);
|
||||
Assert.Equal(expectedTagName, output.TagName);
|
||||
}
|
||||
|
||||
|
|
@ -199,7 +199,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
Assert.Equal(expectedPreContent, output.PreContent);
|
||||
Assert.Equal(expectedContent, output.Content);
|
||||
Assert.Equal(expectedPostContent, output.PostContent);
|
||||
Assert.False(output.SelfClosing);
|
||||
Assert.True(output.SelfClosing);
|
||||
Assert.Null(output.TagName); // Cleared
|
||||
}
|
||||
|
||||
|
|
@ -281,11 +281,11 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
// Assert
|
||||
htmlGenerator.Verify();
|
||||
|
||||
Assert.False(output.SelfClosing);
|
||||
Assert.Equal(expectedAttributes, output.Attributes);
|
||||
Assert.Equal(expectedPreContent, output.PreContent);
|
||||
Assert.Equal(expectedContent, output.Content);
|
||||
Assert.Equal(expectedPostContent, output.PostContent);
|
||||
Assert.True(output.SelfClosing);
|
||||
Assert.Equal(expectedTagName, output.TagName);
|
||||
}
|
||||
|
||||
|
|
@ -366,11 +366,11 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
// Assert
|
||||
htmlGenerator.Verify();
|
||||
|
||||
Assert.False(output.SelfClosing);
|
||||
Assert.Equal(expectedAttributes, output.Attributes);
|
||||
Assert.Equal(expectedPreContent, output.PreContent);
|
||||
Assert.Equal(expectedContent, output.Content);
|
||||
Assert.Equal(expectedPostContent, output.PostContent);
|
||||
Assert.True(output.SelfClosing);
|
||||
Assert.Equal(expectedTagName, output.TagName);
|
||||
}
|
||||
|
||||
|
|
@ -450,11 +450,11 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
// Assert
|
||||
htmlGenerator.Verify();
|
||||
|
||||
Assert.False(output.SelfClosing);
|
||||
Assert.Equal(expectedAttributes, output.Attributes);
|
||||
Assert.Equal(expectedPreContent, output.PreContent);
|
||||
Assert.Equal(expectedContent, output.Content);
|
||||
Assert.Equal(expectedPostContent, output.PostContent);
|
||||
Assert.True(output.SelfClosing);
|
||||
Assert.Equal(expectedTagName, output.TagName);
|
||||
}
|
||||
|
||||
|
|
@ -548,11 +548,11 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
// Assert
|
||||
htmlGenerator.Verify();
|
||||
|
||||
Assert.False(output.SelfClosing);
|
||||
Assert.Equal(expectedAttributes, output.Attributes);
|
||||
Assert.Equal(expectedPreContent, output.PreContent);
|
||||
Assert.Equal(expectedContent, output.Content);
|
||||
Assert.Equal(expectedPostContent, output.PostContent);
|
||||
Assert.True(output.SelfClosing);
|
||||
Assert.Equal(expectedTagName, output.TagName);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -225,11 +225,11 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
await tagHelper.ProcessAsync(tagHelperContext, output);
|
||||
|
||||
// Assert
|
||||
Assert.True(output.SelfClosing);
|
||||
Assert.Equal(expectedAttributes, output.Attributes);
|
||||
Assert.Equal(expectedPreContent, output.PreContent);
|
||||
Assert.Equal(expectedContent, output.Content);
|
||||
Assert.Equal(expectedPostContent, output.PostContent);
|
||||
Assert.False(output.SelfClosing);
|
||||
Assert.Equal(expectedTagName, output.TagName);
|
||||
|
||||
Assert.NotNull(viewContext.FormContext?.FormData);
|
||||
|
|
@ -313,11 +313,11 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
await tagHelper.ProcessAsync(tagHelperContext, output);
|
||||
|
||||
// Assert
|
||||
Assert.True(output.SelfClosing);
|
||||
Assert.Equal(expectedAttributes, output.Attributes);
|
||||
Assert.Equal(expectedPreContent, output.PreContent);
|
||||
Assert.Equal(expectedContent, output.Content);
|
||||
Assert.Equal(expectedPostContent, output.PostContent);
|
||||
Assert.False(output.SelfClosing);
|
||||
Assert.Equal(expectedTagName, output.TagName);
|
||||
|
||||
Assert.NotNull(viewContext.FormContext?.FormData);
|
||||
|
|
|
|||
|
|
@ -136,9 +136,9 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
await tagHelper.ProcessAsync(tagHelperContext, output);
|
||||
|
||||
// Assert
|
||||
Assert.True(output.SelfClosing);
|
||||
Assert.Equal(expectedAttributes, output.Attributes);
|
||||
Assert.Equal(expectedContent, output.Content);
|
||||
Assert.False(output.SelfClosing);
|
||||
Assert.Equal(expectedTagName, output.TagName);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,16 +11,16 @@
|
|||
@using (Html.BeginForm("CreateWarehouse", "MvcTagHelper_Home"))
|
||||
{
|
||||
<div>
|
||||
<label asp-for="City" class="warehouse" />
|
||||
<label asp-for="City" class="warehouse"></label>
|
||||
<input asp-for="City" type="text" size="50" />
|
||||
<span asp-validation-for="City" />
|
||||
<span asp-validation-for="City"></span>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Product" class="warehouse" />
|
||||
<select asp-for="Product" asp-items="(IEnumerable<SelectListItem>)ViewBag.Items" />
|
||||
<span asp-validation-for="Product" />
|
||||
<label asp-for="Product" class="warehouse"></label>
|
||||
<select asp-for="Product" asp-items="(IEnumerable<SelectListItem>)ViewBag.Items"></select>
|
||||
<span asp-validation-for="Product"></span>
|
||||
</div>
|
||||
<div asp-validation-summary="ValidationSummary.All" class="warehouse" />
|
||||
<div asp-validation-summary="ValidationSummary.All" class="warehouse"></div>
|
||||
<input type="submit" />
|
||||
}
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -8,26 +8,26 @@
|
|||
<input asp-for="Number" type="number" class="form-control" />
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Name" class="employee" />
|
||||
<label asp-for="Name" class="employee"></label>
|
||||
@Html.TextAreaFor(m => m.Name)
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="PhoneNumber" class="employee" />
|
||||
<label asp-for="PhoneNumber" class="employee"></label>
|
||||
<input asp-for="PhoneNumber" type="tel" />
|
||||
</div>
|
||||
<div>
|
||||
@{
|
||||
var genders = new SelectList(new string[] { "Male", "Female" });
|
||||
}
|
||||
<label asp-for="Gender" class="employee" />
|
||||
<select asp-for="Gender" asp-items="genders" />
|
||||
<label asp-for="Gender" class="employee"></label>
|
||||
<select asp-for="Gender" asp-items="genders"></select>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Remote" class="employee" />
|
||||
<label asp-for="Remote" class="employee"></label>
|
||||
@Html.CheckBoxFor(m=>m.Remote)
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="OfficeNumber" class="employee" />
|
||||
<label asp-for="OfficeNumber" class="employee"></label>
|
||||
@{
|
||||
var offices = new SelectList(new string[] {"1001","1002"});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,67 +20,67 @@
|
|||
<body>
|
||||
<form asp-controller="MvcTagHelper_Order" asp-action="Submit" asp-anti-forgery=" true">
|
||||
<div>
|
||||
<label asp-for="Shipping" class="order" />
|
||||
<label asp-for="Shipping" class="order"></label>
|
||||
<input asp-for="Shipping" type="text" asp-format="Your shipping method is {0}" size="50" />
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="ShippingDateTime" class="order" />
|
||||
<label asp-for="ShippingDateTime" class="order"></label>
|
||||
<input asp-for="ShippingDateTime" type="datetime-local" />
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Products" class="order" />
|
||||
<label asp-for="Products" class="order"></label>
|
||||
@{ var @object = "multiple"; }
|
||||
<select asp-for="@Model.Products" asp-items="@((IEnumerable<SelectListItem>)ViewBag.Items)" multiple="@(@object)" />
|
||||
<select asp-for="@Model.Products" asp-items="@((IEnumerable<SelectListItem>)ViewBag.Items)" multiple="@(@object)"></select>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="SubstituteProducts" class="order" />
|
||||
<label asp-for="SubstituteProducts" class="order"></label>
|
||||
@* Use same select list as Products. Selection when Products is non-null is not used here. *@
|
||||
<select asp-for="SubstituteProducts" asp-items="@((IEnumerable<SelectListItem>)ViewBag.Items)" />
|
||||
<select asp-for="SubstituteProducts" asp-items="@((IEnumerable<SelectListItem>)ViewBag.Items)"></select>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="OrderDate" class="order" />
|
||||
<label asp-for="OrderDate" class="order"></label>
|
||||
<input asp-for="OrderDate" type="datetime" asp-format="{0:yyyy/MM/dd/ g}" />
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="NeedSpecialHandle" class="order" />
|
||||
<label asp-for="NeedSpecialHandle" class="order"></label>
|
||||
<input asp-for="NeedSpecialHandle" type="checkbox" />
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="PaymentMethod" class="order" />
|
||||
<label asp-for="PaymentMethod" class="order"></label>
|
||||
<select asp-for="PaymentMethod">
|
||||
<option value="Credit">Credit</option>
|
||||
<option value="Check">Check</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Customer.Number" class="order" />
|
||||
<label asp-for="Customer.Number" class="order"></label>
|
||||
<input asp-for="Customer.Number" type="number" class="form-control" />
|
||||
<span asp-validation-for="Customer.Number" />
|
||||
<span asp-validation-for="Customer.Number"></span>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Customer.Name" class="order" />
|
||||
<label asp-for="Customer.Name" class="order"></label>
|
||||
<input asp-for="Customer.Name" type="text" />
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Customer.Email" class="order" />
|
||||
<label asp-for="Customer.Email" class="order"></label>
|
||||
<input asp-for="Customer.Email" type="email" />
|
||||
<span asp-validation-for="Customer.Email" />
|
||||
<span asp-validation-for="Customer.Email"></span>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Customer.PhoneNumber" class="order" />
|
||||
<label asp-for="Customer.PhoneNumber" class="order"></label>
|
||||
<input asp-for="Customer.PhoneNumber" type="tel" />
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Customer.Password" class="order" />
|
||||
<label asp-for="Customer.Password" class="order"></label>
|
||||
<input asp-for="Customer.Password" type="password" class="form-control" />
|
||||
<span asp-validation-for="Customer.Password" />
|
||||
<span asp-validation-for="Customer.Password"></span>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Customer.Gender" class="order" />
|
||||
<label asp-for="Customer.Gender" class="order"></label>
|
||||
@Html.EditorFor(model => model.Customer.Gender)
|
||||
<span asp-validation-for="Customer.Gender" />
|
||||
<span asp-validation-for="Customer.Gender"></span>
|
||||
</div>
|
||||
<div asp-validation-summary="ValidationSummary.All" class="order" />
|
||||
<div asp-validation-summary="ValidationSummary.All" class="order"></div>
|
||||
<input type="hidden" asp-for="Customer.Key" />
|
||||
<input type="submit" />
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@
|
|||
<body>
|
||||
<form asp-controller="MvcTagHelper_Home" asp-route-action="ProductSubmit" asp-anti-forgery="false" method="get">
|
||||
<div>
|
||||
<label asp-for="HomePage" class="product" />
|
||||
<label asp-for="HomePage" class="product"></label>
|
||||
<input asp-for="HomePage" type="url" size="50" />
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Description" class="product" />
|
||||
<textarea asp-for="Description" rows="4" cols="50" class="product" />
|
||||
<label asp-for="Description" class="product"></label>
|
||||
<textarea asp-for="Description" rows="4" cols="50" class="product"></textarea>
|
||||
</div>
|
||||
<input type="submit" />
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
@* Update HtmlFieldPrefix so generated for, id and name attribute values are correct. *@
|
||||
ViewData.TemplateInfo.HtmlFieldPrefix = fieldPrefix + string.Format("[{0}]", index++);
|
||||
<div>
|
||||
<label asp-for="@(model.HomePage)" class="product" />
|
||||
<label asp-for="@(model.HomePage)" class="product"></label>
|
||||
<input asp-for="@(model.HomePage)" type="url" size="50" disabled="disabled" readonly="readonly" />
|
||||
</div>
|
||||
@await Html.PartialAsync("_ProductPartial", model)
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@
|
|||
@addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers"
|
||||
|
||||
<div>
|
||||
<label asp-for="Number" class="product" />
|
||||
<label asp-for="Number" class="product"></label>
|
||||
<input asp-for="Number" type="number"/>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="ProductName" class="product" />
|
||||
<label asp-for="ProductName" class="product"></label>
|
||||
<input asp-for="ProductName" type="text"/>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Description" class="product" />
|
||||
<textarea asp-for="Description" rows="4" cols="50" class="product" />
|
||||
<label asp-for="Description" class="product"></label>
|
||||
<textarea asp-for="Description" rows="4" cols="50" class="product"></textarea>
|
||||
</div>
|
||||
|
|
@ -10,37 +10,37 @@
|
|||
<body>
|
||||
<form asp-route-area="Customer" asp-controller="MvcTagHelper_Customer" asp-action="Index">
|
||||
<div>
|
||||
<label asp-for="Number" class="order" />
|
||||
<label asp-for="Number" class="order"></label>
|
||||
<input asp-for="Number" type="number" class="form-control" />
|
||||
<span asp-validation-for="Number" />
|
||||
<span asp-validation-for="Number"></span>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Name" class="order" />
|
||||
<label asp-for="Name" class="order"></label>
|
||||
<input asp-for="Name" type="text" />
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Email" class="order" />
|
||||
<label asp-for="Email" class="order"></label>
|
||||
<input asp-for="Email" type="email" />
|
||||
<span asp-validation-for="Email" />
|
||||
<span asp-validation-for="Email"></span>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="PhoneNumber" class="order" />
|
||||
<label asp-for="PhoneNumber" class="order"></label>
|
||||
<input asp-for="PhoneNumber" type="tel" />
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Password" class="order" />
|
||||
<label asp-for="Password" class="order"></label>
|
||||
<input asp-for="Password" type="password" class="form-control" />
|
||||
<span asp-validation-for="Password" />
|
||||
<span asp-validation-for="Password"></span>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Gender" class="order" />
|
||||
<label asp-for="Gender" class="order"></label>
|
||||
<input asp-for="Gender" type="radio" value="Male" /> Male
|
||||
<input asp-for="Gender" type="radio" value="Female" /> Female
|
||||
<span asp-validation-for="Gender" />
|
||||
<span asp-validation-for="Gender"></span>
|
||||
</div>
|
||||
<div asp-validation-summary="ValidationSummary.All" class="order" />
|
||||
<div asp-validation-summary="ValidationSummary.ModelOnly" class="order" />
|
||||
<input type="submit" />
|
||||
<div asp-validation-summary="ValidationSummary.All" class="order"></div>
|
||||
<div asp-validation-summary="ValidationSummary.ModelOnly" class="order"></div>
|
||||
<input type="submit"></input>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -23,6 +23,7 @@ namespace TagHelpersWebSite.TagHelpers
|
|||
Info.CopyrightYear.ToString(),
|
||||
Info.Approved.ToString(),
|
||||
Info.TagsToShow.ToString());
|
||||
output.SelfClosing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -25,47 +25,47 @@
|
|||
<div asp-validation-summary="ValidationSummary.All" class="text-danger">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Age" class="control-label col-md-2" />
|
||||
<label asp-for="Age" class="control-label col-md-2"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Age" class="form-control" />
|
||||
<span asp-validation-for="Age" />
|
||||
<span asp-validation-for="Age"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Email" class="control-label col-md-2" />
|
||||
<label asp-for="Email" class="control-label col-md-2"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Email" class="form-control" />
|
||||
<span asp-validation-for="Email" />
|
||||
<span asp-validation-for="Email"></span>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" asp-for="EmployeeId" value="0" />
|
||||
<div class="form-group">
|
||||
<label asp-for="FullName" class="control-label col-md-2" />
|
||||
<label asp-for="FullName" class="control-label col-md-2"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="FullName" class="form-control" />
|
||||
<span asp-validation-for="FullName" />
|
||||
<span asp-validation-for="FullName"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Gender" class="control-label col-md-2" />
|
||||
<label asp-for="Gender" class="control-label col-md-2"></label>
|
||||
<div class="col-md-10">
|
||||
<input type="radio" asp-for="Gender" value="M" /> Male
|
||||
<input type="radio" asp-for="Gender" value="F" /> Female
|
||||
<span asp-validation-for="Gender" />
|
||||
<span asp-validation-for="Gender"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="JoinDate" class="control-label col-md-2" />
|
||||
<label asp-for="JoinDate" class="control-label col-md-2"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="JoinDate" class="form-control" />
|
||||
<span asp-validation-for="JoinDate" />
|
||||
<span asp-validation-for="JoinDate"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Salary" class="control-label col-md-2" />
|
||||
<label asp-for="Salary" class="control-label col-md-2"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Salary" class="form-control" />
|
||||
<span asp-validation-for="Salary" />
|
||||
<span asp-validation-for="Salary"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -15,5 +15,5 @@
|
|||
Version = new Version(1, 1),
|
||||
CopyrightYear = 1990,
|
||||
Approved = true,
|
||||
TagsToShow = 30 }" />
|
||||
TagsToShow = 30 }"/>
|
||||
</div>
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
@{
|
||||
Layout = null;
|
||||
}
|
||||
<root />
|
||||
<root></root>
|
||||
|
||||
|
||||
<nested>some-content</nested>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
layout:<root/>
|
||||
layout:<root></root>
|
||||
@RenderBody()
|
||||
Loading…
Reference in New Issue