HTMLTable

G

Guest

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


however between calls to this function, I am not able to maintain the state...my table initially has 2 rows...then i add one...so now there are three rows...now when I add more rows the last row gets overwritten...The count property of Rows also remains constant at 3...immediately after adding row it shows count as 4, but when I am back into this function it is reset to 3...does any body have any idea about why this would happen?

Thanks!!!
 
K

Kevin Spencer

It sounds like you are performing a PostBack "between calls to this
function." As HTTP is stateless, the page class has to be rebuilt from
scratch with each Request (or PostBack). Therefore, if you add a row with a
PostBack, you have to re-add it with each successive PostBack.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

Vikram said:
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


however between calls to this function, I am not able to maintain the
state...my table initially has 2 rows...then i add one...so now there are
three rows...now when I add more rows the last row gets overwritten...The
count property of Rows also remains constant at 3...immediately after adding
row it shows count as 4, but when I am back into this function it is reset
to 3...does any body have any idea about why this would happen?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top