By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,543 Members | 2,220 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,543 IT Pros & Developers. It's quick & easy.

HtmlTable Postback Issue

P: n/a
What I'm trying to do seems pretty straightforward so I must be missing
something simple. Any help is greatly appreciated.

On my page I have a DropDownList, a HtmlTable and a Button. Each row in the
HtmlTable consists of 5 cells individually populated with a single checkbox.
The DropDownList value dictates what populates the HtmlTable. On the
SelectedIndexChanged event of the DropDownList I populate the HtmlTable based
on the DropDownList value passed to a Stored Procedure. When the Button is
clicked I would like to capture the values of each CheckBox in each of the
HtmlTables rows.

If I place the function call to populate the HtmlTable outside of my
(!IsPostBack) check everything works perfectly as long as I don't fire the
DropDownList SelectedIndexChanged event. If I fire the SelectedIndexChanged
event, I receive an error stating that "Multiple controls with the same ID
'XXXX' were found."

If I place the function call to populate the HtmlTable inside of my
(!IsPostBack) check, the SelectedIndexChanged event fires off beautifully.
Everything works fine. The HtmlTable is populated with the correct rows
reflecting the results from the Stored Procedure. The problem is that when I
click the Button to capture the values, I'm unable to access the checkbox
values. The rows to my HtmlTable (and the checkboxes) don't exist.

I assume that since I'm close to my desired results with both approaches
that it has to be something simple that I'm overlooking. Thanks for your
help.

Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
What are you doing in the ddl's SelectedIndexChanged event that you are
getting the error?

If you want to render a populated table, the best control for the is the
DataGrid. You can use TemplateColumns to put checkboxes inside the cells.
You can use ViewState to make the table persist between postbacks.
Databinding is straightforward. You would need to enable viewstate, databind
the grid once inside the (!IsPostBack) block, and then databind it again in
the ddl's SelectedIndexChanged event.
Eliyahu

"TRobran" <trobran@nospam_gmail.com> wrote in message
news:C0**********************************@microsof t.com...
What I'm trying to do seems pretty straightforward so I must be missing
something simple. Any help is greatly appreciated.

On my page I have a DropDownList, a HtmlTable and a Button. Each row in the HtmlTable consists of 5 cells individually populated with a single checkbox. The DropDownList value dictates what populates the HtmlTable. On the
SelectedIndexChanged event of the DropDownList I populate the HtmlTable based on the DropDownList value passed to a Stored Procedure. When the Button is clicked I would like to capture the values of each CheckBox in each of the
HtmlTables rows.

If I place the function call to populate the HtmlTable outside of my
(!IsPostBack) check everything works perfectly as long as I don't fire the
DropDownList SelectedIndexChanged event. If I fire the SelectedIndexChanged event, I receive an error stating that "Multiple controls with the same ID
'XXXX' were found."

If I place the function call to populate the HtmlTable inside of my
(!IsPostBack) check, the SelectedIndexChanged event fires off beautifully.
Everything works fine. The HtmlTable is populated with the correct rows
reflecting the results from the Stored Procedure. The problem is that when I click the Button to capture the values, I'm unable to access the checkbox
values. The rows to my HtmlTable (and the checkboxes) don't exist.

I assume that since I'm close to my desired results with both approaches
that it has to be something simple that I'm overlooking. Thanks for your
help.

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.