GithubHelp home page GithubHelp logo

picu63 / formgenerator Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 758 KB

Library for generating dynamically forms by generic type in ASP.NET Web Forms

ASP.NET 0.77% C# 12.02% CSS 0.13% JavaScript 87.07%

formgenerator's Introduction

Form Generator

The project was created because of the need for ASP.NET Web Forms technology to create unified forms based on properties in object models. To use FormGenerator, you must assign provided attributes to the model properties that you need.

Example demo:

Demo model:

[Header("User edit")]
public class User
{
    [NormalField("userFirstName","First name", VariableType.String) ]
    public string FirstName { get; set; }
    [NormalField("userLastName", "Last name",VariableType.String)]
    public string LastName { get; set; }
    [EnumField("userRole", "Role", ControlDataType.DropDownList, 
		        defaultValue: (int)Models.Role.Manager)]
    public Role Role { get; set; }
    [NormalField("userIsMale?","Is male?", VariableType.Bool)]
    public bool IsMale { get; set; }
}

Usage

ASPX File:

<asp:PlaceHolder runat="server" ID="dynamicPH"></asp:PlaceHolder>

Code behind:

dynamicPH.Controls.Add(new FormGenerator<User>()
    .AddSection(new FieldsSection<User>())
    .AddSection(new ButtonsSection<User>())
    .CreateForm()
    .FillWithData(new User() {FirstName = "Jordan", 
					LastName = "Peterson", 
					Role = Role.Administrator, 
					IsMale = true)));

Output:

Form Generator Simple Demo

Attributes

  • DataFieldAttribute - Represents

formgenerator's People

Contributors

picu63 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.