0

I have an Edit.cshtml file that fills 3 values from a Model into text edit boxes. One of those boxes gets its value from an IConfiguration configuration in the Controller In the Controller I do a

var defColour = appConfig.GetSection("Colours");
if(!defColour.Exists())

but it won't let me set a value for defColour as a SetSection call doesn't seen to exist and thus when my Edit.cshtml runs it fills the text box with the non-null value:

Microsoft.Extensions.Configuration.ConfigurationSection

What is the best way to get around this as I need a default colour to exist and it is not something that i read in from file (into _context) like all the other data.

My Startup.cs has the following:

public IConfiguration Configuration { get; private set; }

thanks for your help, I am very new to the C#, jquery world and I am taking an existing product and updating it

cheers!

tj26
  • 109
  • 6
  • Does this answer your question? [Write values in app.config file](https://stackoverflow.com/questions/4758598/write-values-in-app-config-file) – Zer0 Aug 14 '21 at 01:52

0 Answers0