Mohammad Olfatmiri
Mohammad Olfatmiri

Reputation: 1675

make a structure for generating custom form

I am developing a learning management system with asp.net c# now i want to make a structure for generating university forms , but these forms may change in future or need new forms , i want make a structure for admin of website to generate custom forms without coding, admin only add the name of feilds and type of that ( its text box or checkbox and ... ) , then it should be a printable from , also admin can add explanation in diffrent part of the form... i dont know how should i do this ?

is there any API or some idea ?

Upvotes: 0

Views: 71

Answers (1)

dburner
dburner

Reputation: 1007

You could make some clases for your form controls like: InputBox, TextBox, CheckBox, RadioButton. Then a form class could contain lists of your input controls.

class FormInputControl
{
     public string Description { get; set; } //Every form input has a description like User, link, what you want that form input control instance to describe
     public abstract object Value { get; set; }
}

class InputBox : FormInputControl
{
     public string Text { get; set; }
     public overwrite object Value
     {
         get { return Text; }
         set { Text = value as string; }
     }
}


class Form
{
     public IList<FormInputControls> { get; set; }
}

Upvotes: 1

Related Questions