Implemented interface member:
property
ViewData
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>.ViewData
2 writes to ViewData
Microsoft.AspNetCore.Mvc.ViewFeatures (2)
HtmlHelperOfT.cs (2)
60ViewData = viewContext.ViewData as ViewDataDictionary<TModel>; 73ViewData = new ViewDataDictionary<TModel>(viewContext.ViewData, viewContext.ViewData.Model);
268 references to ViewData
Microsoft.AspNetCore.Mvc.ViewFeatures (4)
HtmlHelperOfT.cs (4)
62if (ViewData == null) 77if (ViewData == null) 156new ViewDataDictionary<TModelItem>(ViewData, model: null), 311return _modelExpressionProvider.CreateModelExpression(ViewData, expression);
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (264)
DefaultDisplayTemplatesTest.cs (8)
104html.ViewData.TemplateInfo.AddVisited("foo"); 105html.ViewData.TemplateInfo.AddVisited("bar"); 215var templateInfo = html.ViewData.TemplateInfo; 241var viewData = html.ViewData; 267helper.ViewData["Property1"] = "ViewData string"; 289helper.ViewData["Property1"] = "ViewData string"; 334helper.ViewData["Property1"] = "ViewData string"; 363helper.ViewData["Property1"] = "ViewData string";
DefaultEditorTemplatesTest.cs (30)
257helperMock.SetupGet(h => h.ViewData).Returns(helperToCopy.ViewData); 294html.ViewData.TemplateInfo.AddVisited("foo"); 295html.ViewData.TemplateInfo.AddVisited("bar"); 301Assert.Equal(html.ViewData.ModelMetadata.NullDisplayText, HtmlContentUtilities.HtmlContentToString(result)); 327html.ViewData.TemplateInfo.AddVisited("foo"); 328html.ViewData.TemplateInfo.AddVisited("bar"); 453var templateInfo = html.ViewData.TemplateInfo; 482var templateInfo = html.ViewData.TemplateInfo; 504var templateInfo = html.ViewData.TemplateInfo; 529var viewData = helper.ViewData; 553var viewData = helper.ViewData; 583helper.ViewData["Property1"] = "True"; 586helper.ViewData.TemplateInfo.FormattedModelValue = "Formatted string"; 618helper.ViewData.TemplateInfo.FormattedModelValue = "Formatted string"; 658helper.ViewData["Property1"] = "True"; 661helper.ViewData.TemplateInfo.FormattedModelValue = "Formatted string"; 703helper.ViewData.TemplateInfo.FormattedModelValue = "Formatted string"; 743helper.ViewData["Property1"] = "True"; 746helper.ViewData.TemplateInfo.FormattedModelValue = "Formatted string"; 788helper.ViewData.TemplateInfo.FormattedModelValue = "Formatted string"; 814helper.ViewData["Property1"] = "ViewData string"; 859helper.ViewData.TemplateInfo.HtmlFieldPrefix = "FieldPrefix"; 931helper.ViewData.TemplateInfo.HtmlFieldPrefix = "FieldPrefix"; 1003helper.ViewData.TemplateInfo.HtmlFieldPrefix = "FieldPrefix"; 1072helper.ViewData.TemplateInfo.HtmlFieldPrefix = "FieldPrefix"; 1142helper.ViewData.TemplateInfo.HtmlFieldPrefix = "FieldPrefix"; 1209helper.ViewData.TemplateInfo.HtmlFieldPrefix = "FieldPrefix"; 1231helper.ViewData["Property1"] = "ViewData string"; 1280helper.ViewData["Property1"] = "ViewData string"; 1311helper.ViewData["Property1"] = "ViewData string";
Rendering\HtmlHelperCheckboxTest.cs (18)
266helper.ViewData.ModelState.SetModelValue("Property1", new string[] { "false" }, "false"); 285helper.ViewData.Model = new TestModel(); 304helper.ViewData.Remove(nameof(TestModel.Property1)); 305helper.ViewData["Prefix.Property1"] = true; 306helper.ViewData.Model = new TestModel(); 307helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Prefix"; 326helper.ViewData.Remove(nameof(TestModel.Property1)); 327helper.ViewData["Prefix"] = new TestModel { Property1 = true }; 328helper.ViewData.Model = new TestModel(); 347helper.ViewData.Remove(nameof(TestModel.Property1)); 348helper.ViewData["Prefix"] = new TestModel { Property1 = true }; 349helper.ViewData.Model = new TestModel(); 350helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Prefix"; 370helper.ViewData.Model = new TestModel { Property1 = true }; 390helper.ViewData.Model = new TestModel { Property1 = true }; 391helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Prefix"; 430helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Prefix"; 799helper.ViewData.Model = new TestModel { Property1 = true };
Rendering\HtmlHelperDisplayNameExtensionsTest.cs (1)
60helper.ViewData["value"] = "testvalue";
Rendering\HtmlHelperDisplayTextTest.cs (4)
222helper.ViewData["Name"] = "View data dictionary value"; 240helper.ViewData["Name"] = "View data dictionary value"; 258var viewData = helper.ViewData; 283var viewData = helper.ViewData;
Rendering\HtmlHelperDropDownListExtensionsTest.cs (14)
33helper.ViewData.ModelState.SetModelValue("Property1", 3, "3"); 34helper.ViewData["Property1"] = BasicSelectList; 57helper.ViewData.ModelState.SetModelValue("Property1", 1, "1"); 58helper.ViewData["Property1"] = BasicSelectList; 83helper.ViewData.Model = new TestModel { Property2 = "4" }; 108helper.ViewData.ModelState.SetModelValue("Property1", 4, "4"); 109helper.ViewData["Property1"] = BasicSelectList; 135helper.ViewData.Model = new TestModel { Property2 = "5" }; 157helper.ViewData["Property1"] = BasicSelectList; 158helper.ViewData.Model = new TestModel { Property1 = 0 }; 183helper.ViewData["Property1"] = BasicSelectList; 184helper.ViewData.Model = new TestModel { Property2 = "5" }; 209helper.ViewData.Model = new TestModel { Property3 = new List<string> { "0", "2", "4" } }; 235helper.ViewData.Model = new TestModel { Property2 = "5" };
Rendering\HtmlHelperHiddenTest.cs (47)
67helper.ViewData.Model.Property1 = "should-not-be-used"; 83helper.ViewData.Model.Property1 = "model-property1-value"; 84helper.ViewData["Prefix"] = new HiddenModel { Property1 = "contained-view-data-value" }; 100helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Prefix"; 101helper.ViewData.Model.Property1 = "model-property1-value"; 102helper.ViewData["Prefix"] = new HiddenModel { Property1 = "contained-view-data-value" }; 118helper.ViewData.Model.Property1 = "model-property1-value"; 119helper.ViewData["Property1"] = null; 135helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Prefix"; 136helper.ViewData.Model.Property1 = "model-property1-value"; 137helper.ViewData["Prefix.Property1"] = null; 153helper.ViewData.Clear(); 200helper.ViewData.Model.Property1 = "test-value"; 215helper.ViewData.ModelState.Clear(); 216helper.ViewData.Model.Property1 = "property-value"; 231helper.ViewData.ModelState.Clear(); 232helper.ViewData.Model.Property1 = "property-value"; 247helper.ViewData.Model.Property1 = "property-value"; 263helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Prefix"; 264helper.ViewData.Model.Property1 = "property-value"; 294helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Prefix"; 326helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Prefix"; 376helper.ViewData.ModelState.Clear(); 377helper.ViewData.ModelState.SetModelValue( 381helper.ViewData.ModelState.SetModelValue( 385helper.ViewData.ModelState.SetModelValue( 407helper.ViewData.ModelState.Clear(); 408helper.ViewData.Clear(); 409helper.ViewData.Add("Property1", "vdd-without-prefix"); 410helper.ViewData.Add("MyPrefix.Property1", "vdd-with-prefix"); 411helper.ViewData.Add("MyPrefix$Property1", "vdd-with-iddotreplacement"); 588helper.ViewData.Model.Bytes = new byte[] { 23, 43, 53 }; 603helper.ViewData.Model.Property1 = "test"; 618helper.ViewData.Model.Property1 = "DefaultValue"; 633helper.ViewData.ModelState.Clear(); 634helper.ViewData.Model.Property1 = "PropertyValue"; 649helper.ViewData.Model.Property1 = null; 650helper.ViewData.ModelState.Clear(); 682helper.ViewData.Model.Property1 = "propValue"; 701helper.ViewData.Model.Property1 = "propValue"; 703helper.ViewData.ModelState.Clear(); 704helper.ViewData.ModelState.SetModelValue( 708helper.ViewData.ModelState.SetModelValue( 712helper.ViewData.ModelState.SetModelValue( 895helper.ViewData.Model = new TestModel { Property1 = "propValue" }; 913helper.ViewData.Model = new TestModel { Property1 = "propValue" }; 931helper.ViewData.Model = new TestModel { Property1 = "propValue" };
Rendering\HtmlHelperLabelExtensionsTest.cs (5)
120helper.ViewData.ModelExplorer = modelExplorer; 139helper.ViewData["value"] = "testvalue"; 188helper.ViewData.TemplateInfo.HtmlFieldPrefix = "prefix"; 292helper.ViewData.ModelExplorer = provider 295helper.ViewData.TemplateInfo.HtmlFieldPrefix = nameof(DefaultTemplatesUtilities.ObjectTemplateModel.Property1);
Rendering\HtmlHelperListBoxExtensionsTest.cs (7)
33helper.ViewData.ModelState.SetModelValue("Property1", 2, "2"); 34helper.ViewData["Property1"] = BasicSelectList; 59helper.ViewData.Model = new TestModel { Property3 = new List<string> { "4" } }; 84helper.ViewData["Property2"] = new List<string> { "1", "2", "5" }; 106helper.ViewData["Property1"] = BasicSelectList; 131helper.ViewData.Model = new TestModel { Property3 = new List<string> { "0", "4", "5" } }; 156helper.ViewData["Property3"] = new List<string> { "0", "2" };
Rendering\HtmlHelperNameExtensionsTest.cs (2)
75helper.ViewData.TemplateInfo.HtmlFieldPrefix = prefix; 124helper.ViewData.TemplateInfo.HtmlFieldPrefix = prefix;
Rendering\HtmlHelperPartialExtensionsTest.cs (6)
417var viewData = helper.ViewData; 446var viewData = helper.ViewData; 477var viewData = helper.ViewData; 506var viewData = helper.ViewData; 535var viewData = helper.ViewData; 566var viewData = helper.ViewData;
Rendering\HtmlHelperPasswordTest.cs (14)
260helper.ViewData.Model.Property1 = "test"; 384helper.ViewData.Model = new TestModel { Property1 = "propValue" }; 402helper.ViewData.Model = new TestModel { Property1 = "propValue" }; 420helper.ViewData.Model = new TestModel { Property1 = "propValue" }; 505helper.ViewData.TemplateInfo.HtmlFieldPrefix = "pre"; 507helper.ViewData.ModelState.SetModelValue("pre.Property3[key]", "MProp3Val", "MProp3Val"); 508helper.ViewData.ModelState.SetModelValue("pre.Property4.Property5", "MProp5Val", "MProp5Val"); 509helper.ViewData.ModelState.SetModelValue("pre.Property4.Property6[0]", "MProp6Val", "MProp6Val"); 511helper.ViewData["pre.Property3[key]"] = "VDProp3Val"; 512helper.ViewData["pre.Property4.Property5"] = "VDProp5Val"; 513helper.ViewData["pre.Property4.Property6"] = "VDProp6Val"; 515helper.ViewData.Model.Property3["key"] = "Prop3Val"; 516helper.ViewData.Model.Property4.Property5 = "Prop5Val"; 517helper.ViewData.Model.Property4.Property6.Add("Prop6Val");
Rendering\HtmlHelperRadioButtonExtensionsTest.cs (3)
55helper.ViewData.Model = new TestModel { Property1 = value }; 75helper.ViewData.Model = new TestModel { Property1 = value }; 108helper.ViewData.Model = new TestModel { Property2 = true };
Rendering\HtmlHelperSelectTest.cs (13)
354helper.ViewData["Property1"] = selectList; 582helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Prefix"; 623helper.ViewData["Property1"] = selectList; 672helper.ViewData["Property1"] = selectList; 985helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Prefix"; 1089helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Property1"; 1121helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Property1"; 1145helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Property1"; 1165helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Property1"; 1186helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Property1"; 1216helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Property1"; 1237helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Property1"; 1259helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Property1";
Rendering\HtmlHelperTest.cs (1)
303helperToContextualize.ViewData);
Rendering\HtmlHelperTextAreaExtensionsTest.cs (5)
22helper.ViewData.Model = new TestModel { Property1 = "propValue" }; 41helper.ViewData.Model = new TestModel { Property1 = "propValue" }; 60helper.ViewData.Model = new TestModel { Property1 = "propValue" }; 79helper.ViewData.Model = new TestModel { Property1 = "propValue" }; 99helper.ViewData.Model = new TestModel { Property1 = "propValue" };
Rendering\HtmlHelperTextAreaTest.cs (11)
75helper.ViewData.TemplateInfo.HtmlFieldPrefix = "pre"; 77helper.ViewData.Model.Property3["key"] = "Prop3Val"; 78helper.ViewData.Model.Property4.Property5 = "Prop5Val"; 79helper.ViewData.Model.Property4.Property6.Add("Prop6Val"); 122helper.ViewData.TemplateInfo.HtmlFieldPrefix = "pre"; 124helper.ViewData.ModelState.SetModelValue("pre.Property3[key]", "MProp3Val", "MProp3Val"); 125helper.ViewData.ModelState.SetModelValue("pre.Property4.Property5", "MProp5Val", "MProp5Val"); 126helper.ViewData.ModelState.SetModelValue("pre.Property4.Property6[0]", "MProp6Val", "MProp6Val"); 128helper.ViewData.Model.Property3["key"] = "Prop3Val"; 129helper.ViewData.Model.Property4.Property5 = "Prop5Val"; 130helper.ViewData.Model.Property4.Property6.Add("Prop6Val");
Rendering\HtmlHelperTextBoxExtensionsTest.cs (5)
23helper.ViewData.Model = new TestModel { Property1 = "propValue" }; 41helper.ViewData.Model = new TestModel { Property1 = "propValue" }; 59helper.ViewData.Model = new TestModel { Property1 = "propValue" }; 77helper.ViewData.Model = new TestModel { Property1 = "propValue" }; 95helper.ViewData.Model = new TestModel { Property1 = "propValue" };
Rendering\HtmlHelperTextBoxTest.cs (11)
93helper.ViewData.TemplateInfo.HtmlFieldPrefix = "pre"; 95helper.ViewData.Model.Property3["key"] = "Prop3Val"; 96helper.ViewData.Model.Property4.Property5 = "Prop5Val"; 97helper.ViewData.Model.Property4.Property6.Add("Prop6Val"); 140helper.ViewData.TemplateInfo.HtmlFieldPrefix = "pre"; 142helper.ViewData.ModelState.SetModelValue("pre.Property3[key]", "MProp3Val", "MProp3Val"); 143helper.ViewData.ModelState.SetModelValue("pre.Property4.Property5", "MProp5Val", "MProp5Val"); 144helper.ViewData.ModelState.SetModelValue("pre.Property4.Property6[0]", "MProp6Val", "MProp6Val"); 146helper.ViewData.Model.Property3["key"] = "Prop3Val"; 147helper.ViewData.Model.Property4.Property5 = "Prop5Val"; 148helper.ViewData.Model.Property4.Property6.Add("Prop6Val");
Rendering\HtmlHelperValidationSummaryTest.cs (45)
209html.ViewData.ModelState.AddModelError(string.Empty, "This is my validation message"); 234html.ViewData.TemplateInfo.HtmlFieldPrefix = "this.is.my.prefix"; 235html.ViewData.ModelState.AddModelError("this.is.my.prefix", "This is my validation message"); 260html.ViewData.ModelState.AddModelError("Property1", "This is my validation message"); 283html.ViewData.TemplateInfo.HtmlFieldPrefix = prefix; 284AddMultipleErrors(html.ViewData.ModelState); 310AddMultipleErrors(html.ViewData.ModelState); 311html.ViewData.ModelState.RemoveAll<ValidationModel>(m => m.Property2); 312html.ViewData.ModelState.Remove<ValidationModel>(m => m.Property3); 313html.ViewData.ModelState.Remove<ValidationModel>(m => m.Property3.OrderedProperty2); 314html.ViewData.ModelState.AddModelError("Property2", "New error for Property2."); 347AddMultipleErrors(html.ViewData.ModelState); 348html.ViewData.ModelState.AddModelError("non-existent-property1", "non-existent-error1"); 349html.ViewData.ModelState.AddModelError("non.existent.property2", "non-existent-error2"); 350html.ViewData.ModelState.AddModelError("non.existent[0].property3", "non-existent-error3"); 376html.ViewData.ModelState.AddModelError("Property1", "Property1 error"); 377html.ViewData.ModelState.AddModelError("Property2[0].OrderedProperty1", "Property2[0].OrderedProperty1 error"); 378html.ViewData.ModelState.AddModelError("Property2[10].Property2", "Property2[10].Property2 error"); 379html.ViewData.ModelState.AddModelError("Property2[2].Property3", "Property2[2].Property3 error"); 380html.ViewData.ModelState.AddModelError("Property2[0].Property1", "Property2[0].Property1 error"); 406html.ViewData.ModelState.AddModelError("[0].OrderedProperty2", "[0].OrderedProperty2 error"); 407html.ViewData.ModelState.AddModelError("[0].Property1", "[0].Property1 error"); 408html.ViewData.ModelState.AddModelError("[0].OrderedProperty1", "[0].OrderedProperty1 error"); 409html.ViewData.ModelState.AddModelError("[2].Property3", "[2].Property3 error"); 410html.ViewData.ModelState.AddModelError("[2].OrderedProperty3", "[2].OrderedProperty3 error"); 438html.ViewData.ModelState.AddModelError("[0].OrderedProperty2", "[0].OrderedProperty2 error"); 439html.ViewData.ModelState.AddModelError("[0].Property1", "[0].Property1 error"); 440html.ViewData.ModelState.AddModelError("[0].OrderedProperty1", "[0].OrderedProperty1 error"); 441html.ViewData.ModelState.AddModelError("[2].Property3", "[2].Property3 error"); 442html.ViewData.ModelState.AddModelError("[2].OrderedProperty3", "[2].OrderedProperty3 error"); 443html.ViewData.ModelState.AddModelError("OrderedProperty1", "OrderedProperty1 error"); 444html.ViewData.ModelState.AddModelError("OrderedProperty2", "OrderedProperty2 error"); 477AddOrderedErrors(html.ViewData.ModelState); 495helper.ViewData.ModelState.AddModelError("Property1", "Error for Property1"); 513helper.ViewData.ModelState.AddModelError("Property1", "Error for Property1"); 527helper.ViewData.ModelState.AddModelError("Property1", "Error for Property1"); 546helper.ViewData.ModelState.AddModelError("Property1", "Error for Property1"); 565helper.ViewData.ModelState.AddModelError(string.Empty, "Error for root"); 566helper.ViewData.ModelState.AddModelError("Property1", "Error for Property1"); 585helper.ViewData.ModelState.AddModelError("Property1", "Error for Property1"); 604helper.ViewData.ModelState.AddModelError("Property1", "Error for Property1"); 623helper.ViewData.ModelState.AddModelError(string.Empty, "Error for root"); 624helper.ViewData.ModelState.AddModelError("Property1", "Error for Property1"); 643helper.ViewData.ModelState.AddModelError(string.Empty, "Error for root"); 644helper.ViewData.ModelState.AddModelError("Property1", "Error for Property1");
Rendering\HtmlHelperValueTest.cs (14)
35helper.ViewData["Prefix.StringProperty"] = "PrefixedViewDataValue"; 36helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Prefix"; 50helper.ViewData["Prefix"] = new { StringProperty = "ContainedViewDataValue" }; 64helper.ViewData["Prefix"] = new { StringProperty = "ContainedViewDataValue" }; 65helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Prefix"; 79helper.ViewData.Clear(); 93helper.ViewData.Clear(); 94helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Prefix"; 108helper.ViewData["StringProperty"] = null; 122helper.ViewData["Prefix.StringProperty"] = null; 123helper.ViewData.TemplateInfo.HtmlFieldPrefix = "Prefix"; 159var viewData = helper.ViewData; 217var viewData = helper.ViewData; 257helper.ViewData["StringProperty"] = "ViewDataValue";