Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding rows to a table

Status
Not open for further replies.

whykeepderegingme

Programmer
May 17, 2005
6
CA
Hey,

I have an ASP:Table that is generated dynamically. I add 10 rows, then I want to have a button, each time pressed will add 5 more rows, while maintaining the data already in the table.

I have had no luck, my table survives postbacks on its own, but as soon as I try to add a new row (I have also tried creating some of the rows with Visible=false, then setting it to True for the appropriate 5 rows), all the other rows just disappear. Stupid Asp.net calls the button click event AFTER the postback, but i need it to be before so that the row changes appear in the viewstate for the table.

Javascript doesn't seem to be working for me either...

Thanks!
 
You didn't post any code but ASP.NET is not stupid.
Let say you have a Web form with a check box, a textbox, and a button. However, if you add code to the TextChanged and CheckChanged event handlers, when the text in Textox1 is changed and the checkbox is checked/unchecked, events are not immediately fired on the server side. When you click the submit button, a series of events will fire on the server side. All of the event handlers, such TextChanged, CheckChanged, will fire. Finally, the button’s click event handler will fire. The order in which the cached events, such as TextChanged, CheckedChanged etc… are fired is fixed and does not represent the sequence in which the user changed the controls in the browser. When all other controls events are fired, the Click event takes place.
Some controls, such as TextBox and CheckBox, do have their own AutoPostBack property, which is set to false by default. If you want to provide immediate feedback, you can set this property to true. Then when text is entered or checkbox is checked, a postback occurs. But doing that could be very expensive. The typical “action controls” that perform postbacks are the Button, ImageButton, LinkButton, and HyperLink.
It is important to keep postbacks to minimum.
obislavu
 
I'm aware of all that, but it doesn't help my problem any.

I don't want to postback if I can avoid it, I just want to modify the HTML for the table, to add some more rows to it, or make some rows visible that were previously invisible (whichever I can get to work, I don't care as long as clicking "MORE" gives the user more rows to work with).

I have an ASP system that does what I want, through javascript (I believe it uses the innerHTML of the table to add more rows). But that javascript no longer works in ASP.NET...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top