hi all

now this is something hard and i hope that someone knows how to do it

lets say that i have a table in the database named "Test"

the table contains this data

Question_____________________Type
What is your name? ________________Txt
How are you?______________________Rad


the webform has only a Button named "Build" for example and a Grid View

the task is:

At runtime when you press the button "Build" the application do 3 things:

1- fill the first column of Grid View with the Questions from the table

this is easy to do

but the second and third are somehow complicated

2- whereever the Type in the tabel "Test" is "Txt" the application create a TextBox control and place it in the second column of the Grid View next to the question that has a Txt type

3- whereever the type is "Rad" the application create a RadioButtion control and place it in the second column of the Grid View next to the question that has a Rad type

does anyone know how to do it?

Patience!

Also, we are not here to do your work for you, the general edicate here is to state the question / problem and provide the work you have tried to to solve it but have been unsuccessful.

Saying that here is some sample code that may help you at least get started.

1. Hopefully you know you will require some logic statements (if/then/else or while, etc) to solve this.
2. Example of adding controls at runtime

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        Dim objTB As TextBox
        objTB.ID = "tbOne"
        objTB.Text = "Hello There"
        Page.Controls.Add(objTB)

    End Sub

Hope this helps
:cool:

hi paladine

you are mistaken its not that i want u to do my work :)

i know how to add the control at runtime

the main point here is how to load the control in the second column of the grid view?

this is the thing i tryed and failed in

this is the question

This article has been dead for over six months. Start a new discussion instead.