473,749 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HtmlTable Postback Issue

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
SelectedIndexCh anged 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 SelectedIndexCh anged event. If I fire the SelectedIndexCh anged
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 SelectedIndexCh anged 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
1 2460
What are you doing in the ddl's SelectedIndexCh anged 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 SelectedIndexCh anged event.
Eliyahu

"TRobran" <trobran@nospam _gmail.com> wrote in message
news:C0******** *************** ***********@mic rosoft.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
SelectedIndexCh anged 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 SelectedIndexCh anged event. If I fire the SelectedIndexCh anged 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 SelectedIndexCh anged 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
7232
by: Ajay Desh | last post by:
Hi I am gettin error, if i try to find the top position of a table. Here is what i am doing.I have a HtmlTable (Table3 is the name/id) created.It has a position and a Top and Left co-ordinates assigned. I have a button to add a row to this table. When i click on this button the code behind is : private void add_ServerClick(object sender, System.EventArgs e) {
2
403
by: Michael Meckelein | last post by:
Hi all! I have a table like Table myTable = new Table(); Now, I want to publish the table as part of a webpage and as part of a word document. I tried to convert the table, but the compiler say "Cannot convert type 'System.Web.UI.WebControls.Table' to 'System.Web.UI.HtmlControls.HtmlTable'" if I use (HtmlTable)myTable.
1
1341
by: Vikram | last post by:
I have a .aspx page with a server side table...i am adding rows to this table on submit of some button...something like this Sub AddRow(Sender As Object, E As EventArgs) .. .. .. MyTable.Rows.Add(r) End Sub
2
6283
by: Alfred Salton | last post by:
Can anyone show me how to set the css class of an HtmlTable control in code on the server? I can't find any indication that the css class is a property of the HtmlTable, HtmlTableRow and HtmlTableCell classes. I'm getting the uncomfortable feeling that this can't be done, even though it seems incredible to me!
2
3883
by: Raed Sawalha | last post by:
Hi, This is probably pretty simple but... I am dynamically adding rows to a HtmlTable that contain Textbox controls. (There may be more than one server control/textbox in a given cell) How do I get the value of a textbox when the form is posted back? I would expect something like:
1
4764
by: Leo | last post by:
I created a user control which is some text contained in a HtmlTable. I put this control into main form. I would like to have the ability to move this control around in the main form. I think one way to do this is to change the style of this control at runtime ("Left:xx px; Top:xx px"). Another way is to move the HtmlTable in the control (i.e. change the style of it). However I couldn't figure out how to let it work. At design time, I...
3
2759
by: teo | last post by:
Mozilla error on postback and validation ----------- A Button causes a Listbox to desappear. If no item has been selected on the Listbox, all is OK. If one or more items are selected,
0
2301
by: redaudi | last post by:
I'm hoping someone might be able to help me with the following issue. Basically I'm creating a htmltable on the fly and then simply populating it with rows and cells accordingly. My test site has a CSS sheet which applies styling etc. My problem is that I can't find a method of adding a THEAD tag into the table. For example I start with HtmlTable td = new HtmlTable(); HtmlTableRow tblRow = new HtmlTableRow();
0
1258
by: purnimakarnati | last post by:
Hi All, Can anybody solve my problem. I created a HTMLTable with a dataset by a method called addTable(dataset) After creating a new table and new row I am adding cells and in each cell I am adding a HtmlInputText control as follows cell = new HtmlTableCell(); cell.Width="100"; cell.VAlign="top"; input = new HtmlInputText("text"); input.ID = "Pwd"+"_"+r.ToString();
0
8996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9386
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9333
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.