0

I'm trying to build a list of checkboxes, each one with a textbox/textarea associated to it.

The plan is for it to look something like this

[checkbox]
[textbox]

[checkbox]
[textbox]

[checkbox]
[textbox]

etc.

The title of each checkbox & textbox will be populated from the database.

I'm not really sure how to go about doing this.

Any help would be greatly appreciated.

Thanks.

2 Answers 2

1

The easiest solution will be to create a user control.

In that control you can have a label, a textbox and a checkbox. Create public properties for setting the values such as the label text and retrieving values such as textbox.Text and Checkbox.Checked

You can then add this control to your asp.net page as many times as you like either manually or programmatically.

Sign up to request clarification or add additional context in comments.

Comments

1

You can begin with a table structure to store text/check boxes ,something like

<table class="style1">
        <tr>
            <td>
                <asp:CheckBox ID="CheckBox1" runat="server" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            </td>
        </tr>

    </table>

Then set properties that you need during the page load event. Or if you plan to use it more than once it'll be a good idea to pack everything into a user control

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.