Generating and Representing an ASP.NET Dynamic Form

I need to create a form where for each day of the month the user will enter several different values ​​(I think the grid view, the values ​​at the top, the day of the month are on the side) using ASP.NET forms with a C # backend ...

So what would be the best way to create this form? I don’t want hardcode that many controls, as it would make the feed a little annoying, but I would also have to be able to enter the values ​​entered in previous days and display them in text boxes.

How do I start creating this form, as well as how to get values ​​from text fields in the backend?

+3
source share
3 answers

, . VB.Net, , #.

http://www.asp101.com/samples/form_dynamic_aspx.asp

, , , , Request.Form.

+2

ASP.NET MVC, , Dynamic Forms codeplex: http://mvcdynamicforms.codeplex.com/

, ( XML, ..), Request .

0

, FormFactory.

PropertyVm[]:

`` `

var vm = new MyFormViewModel
{
    OperatingSystem = "IOS",
    OperatingSystem_choices = new[]{"IOS", "Android",};
};
Html.PropertiesFor(vm).Render(Html);

`` `

, , PropertyVm.

Linqpad script.

`` `

//import-package FormFactory
//import-package FormFactory.RazorGenerator


void Main()
{
    var properties = new[]{
        new PropertyVm(typeof(string), "username"){
            DisplayName = "Username",
            NotOptional = true,
        },
        new PropertyVm(typeof(string), "password"){
            DisplayName = "Password",
            NotOptional = true,
            GetCustomAttributes = () => new object[]{ new DataTypeAttribute(DataType.Password) }
        }
    };
    var html = FormFactory.RazorEngine.PropertyRenderExtension.Render(properties, new FormFactory.RazorEngine.RazorTemplateHtmlHelper());   

    Util.RawHtml(html.ToEncodedString()).Dump(); //Renders html for a username and password field.
}

`` `

Theres , (, , , ..)

0

Source: https://habr.com/ru/post/1729491/


All Articles