Click here to Skip to main content
16,021,823 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Dear Friends,

In my project i want to display the controls from database. Let me explain the concept can anyone please guide me how to write the code for that.

For example,

In my table am having columns like,

1. Label_Name 2. Control_Name 3. Maximum_Length 4. Mandatory_Status

At every time while am opening the form, controls should generate based on the table details.

Example,

If Fields in tables are like,

Label_Name : Test

Control : Textbox

Maximum_Length :20

Mandatory_Status :Y

Then while i loading the form, form should contains,

Label name as "Test" corresponding control as "Textbox" and it should allow only 20 fields and it should be a mandatory one. Similarly whatever the datas the table having that should generate.

How can i achieve this task. can anyone please guide me to figure out this code.

Thanks in advance.>
Posted

1 solution

Hello,

Do following algorithm you have to concentrate before starting write code:

1. How many types of control would be required e.g. TetxBox, Label, DropDown, CheckBox etc...
2. Created Component for each control
  • 2.1: Apply validation on each control whatever you would like e.g Required, Numeric, AlphaNumeric...
  • 2.2: Publish you component (for drag and drop in your project)

3. Put one PlaceHolder in your forms for appending dynamic control in your forms.
4. Loop each record from database
  • 4.1: Identify current records Control type and accordingly add component (that you have created).
  • 4.2: Increase x and y position for the next control.
  • 4.3: Repeat step 4 until all records has been fetched.

Please do let me know if you have any query.
Thanks,
Imdadhusen
 
Share this answer
 
v3
Comments
Shanmugapriya N 24-May-13 6:25am    
Thanks for your reply.

In this case i cannot fix any validations while. Whenever the client needs they can create new control by providing those data.

At starting itself i am get struggling to write the code.

Please guide me where i have to start the code.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900