rowCnt = rowCnt + 1

becomes

ViewState("rowCnt")=ViewState("rowCnt")+1

Yes in order to have a value survive postbacks tucking it away in ViewState
is necessary.

On 11/2/05, shawnarnwine <[EMAIL PROTECTED]> wrote:
>
>  I'm have a Table Web Server in which I am attempting to dynamically
> add an additional row each time the user clicks on a link button.
> My table has one static header row, then additional rows will be
> added as needed by the user click.
>
> What I'm currently attempting to do is capture if its a Postback,
> then generate the row accordingly. Currently, no matter how many
> times a user clicks, it appears as though the values never get
> updated. Below is my code w/ a few questions after.
>
> ***********
> Public Sub Button1_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> ' Total number of rows
> Dim rowCnt As Integer
> ' Current row count
> Dim rowCtr As Integer
> ' Total number of cells (columns)
> Dim cellCtr As Integer
> ' Current cell counter
> Dim cellCnt As Integer
>
> rowCnt = rowCnt + 1
> cellCnt = 8
>
> For rowCtr = 1 To rowCnt
> Dim tRow As New TableRow()
> For cellCtr = 1 To cellCnt
> Dim tCell As New TableCell()
> tCell.Text = "Row " & rowCtr & ", Cell " & cellCtr
> ' Add new TableCell object to row
> tRow.Cells.Add(tCell)
> Next
> ' Add new row to table
> Table1.Rows.Add(tRow)
> Next
>
> rowCnt = rowCtr 'rowCtr has the current total of rows
>
> End Sub
> ********
>
> Do I need to put the rowCnt into ViewState or a session? As my hope
> is that when I first add a new row, rowCtr would then be 1, so
> rowCnt would then be 1+1 and so on...
>
> Once I start adding the new rows, once again, will I need to use
> ViewState or a session for the rows and their associated data?
>
> Thanks so much for your help.
>
>
>
>
>
>
>
>
>
>
>  SPONSORED LINKS
>   Basic programming 
> language<http://groups.yahoo.com/gads?t=ms&k=Basic+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&c=4&s=126&.sig=bnac3LCZpttb3c9FvbVU-A>
>   Computer
> programming 
> languages<http://groups.yahoo.com/gads?t=ms&k=Computer+programming+languages&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&c=4&s=126&.sig=1Czd2hKCO9_u4KVZQperFQ>
>   Programming
> languages<http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&c=4&s=126&.sig=TyHGCjod4YOKITrSq1xccQ>
>    Java
> programming 
> language<http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&c=4&s=126&.sig=PZAexF9LyXpKb3HDJSlB1g>
>  ------------------------------
> YAHOO! GROUPS LINKS
>
>
>    - Visit your group 
> "AspNetAnyQuestionIsOk<http://groups.yahoo.com/group/AspNetAnyQuestionIsOk>"
>    on the web.
>     - To unsubscribe from this group, send an email to:
>    [EMAIL PROTECTED]<[EMAIL PROTECTED]>
>     - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>    Service <http://docs.yahoo.com/info/terms/>.
>
>
>  ------------------------------
>


[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to