views:

25

answers:

1

I have a gridview in asp.net using vb 2005. on " Protected Overrides Sub Render"some of the data in the columns gets modified. when i do a view source.. and look at a column1's values it says 0010. in the render i am taking a value of ab0010 and turning it into the 0010 that is seen in the view source.. later on, there is a button_click event that goes through each line of the gridview and grabs some values. Here I'm doing a CType(gvr.FindControl("column1"), Label).Text the value is coming back as ab0010.

so the question is.. the view source shows something different than what is in the viewstate? thanks shannon

A: 

I you look at the Page Life Cycle you'll see that viewstate is created before render happens so you're changes aren't detected. If you think about it, this makes sense. In render you could just erase everything and write "Hello World" and you'd get no complaints. You should be using the GridView's RowCreated or RowDataBound events to modify information

Chris Haas