0

I have to create a form in which the user can select fields from a listbox on which he wants the search criteria and then the controls are created according to the selection of the user from the listbox,for example if the listbox consist of fields like

 1. Name
 2. Age
 3. Department
 4. Designation

and if the user wants to have a search based on the Name and Designation then he will select Name and Designation from list box and the two text boxes will be created in the search panel with their respective lables,

And if the user wants to put the search criteria on Age then he can replace the previously selected Name and Designation field with Age and then only 1 TextBox will be created with label age in the search panel,

So what is the best possible way to achieve this requirement,please suggest me,any sort of help will be highly appreciable

Thanks in Advance

Anuj
  • 1,496
  • 1
  • 18
  • 28
  • i want to write the code in C# with oracle as back-end – Anuj Jul 01 '13 at 12:03
  • what you have commented is correct,but for the later part but initially i want to generate the search criteria panel according to the field selected by the user,like i have mentioned in my question – Anuj Jul 01 '13 at 12:07
  • i want to know how to create dynamic controls based on the fields selected fro eg. if user selects Name and age the two text boxes should be created in the search criteria panel – Anuj Jul 01 '13 at 12:12
  • 1
    i think the best approach would be to write some jscript which will add/remove or enable/disable textboxes when selected item is changed – Guru Stron Jul 01 '13 at 12:13
  • thanks for your suggestion i am implementing the code with your helps thanks a lot – Anuj Jul 01 '13 at 12:21

1 Answers1

1

Adding controls dynamically is not a hard concept, Just do searches for adding controls dynamically to whatever UI technology you are using.

Here is a basic tutorial that adds a Textbox to a webform http://www.c-sharpcorner.com/UploadFile/0c1bb2/adding-web-forms-controls-dynamically-in-Asp-Net-C-Sharp-web-appl/

Using JQuery http://totaldotnet.com/article/showarticle130_dynamiccontroljquery.aspx

A question about adding to WPF WPF: How to dynamically Add Controls in dynamically created WPF Window

Or Windows Form, http://anthonystechblog.wordpress.com/2009/11/12/net-c-how-to-dynamicall-add-controls-to-a-form-and-hook-up-their-events/

Community
  • 1
  • 1
Wes Grant
  • 2,044
  • 16
  • 14
  • thank u very much i got the correct path for starting with the implementation of my code your suggetions helped me to start thans again – Anuj Jul 01 '13 at 12:23