gpdeering
Posts: 57
|
Posted: 04/24/2006, 12:49 PM |
|
I've decided that the best way to access the field values in a grid (Repeater) is to save them to a session variable as the grid is being generated in the filename.aspx.vb file.
I believe I'm correct when I say that the grid values are generated by
Protected Sub gridnameItemDataBound()
So, assuming I'm correct here, how do I go about saving each value of a field to an array, then copying that array into session variable?
So far, I'm trying to use the syntax:
localArray(gridnameCurrentRowNumber) = gridnamefieldname.Text
Then, I create a new string variable and concatentate each of the array elements together into the new variable. Then, the variable gets copied into a session variable.
Is this the right way to do it?
Thanks,
--Glen
|
|
|
Diesel
Posts: 43
|
Posted: 04/26/2006, 3:57 AM |
|
You do not need to use an array
Just build your array into your Session variable like this:
Add the following code in the Before Show Row event of your Grid
If System.Web.HttpContect.Current.Session("MyValues") = "" Then
System.Web.HttpContect.Current.Session("MyValues")=gridnamefieldname.text
Else
System.Web.HttpContect.Current.Session("MyValues") = System.Web.HttpContect.Current.Session("MyValues") & "," & gridnamefieldname.text
Regards
|
|
|
gpdeering
Posts: 57
|
Posted: 04/26/2006, 12:57 PM |
|
Excellent idea! That's so simple, it's bound to work! I'll let you know how it turns out.
Thanks again!
--Glen
|
|
|
gpdeering
Posts: 57
|
Posted: 04/27/2006, 5:53 AM |
|
YEAH!!!!
Thanks to your (embarrassingly) simple suggestion, I finally got over the hump! I'm in the final stretch with this project now.
Thanks, Diesel!!!
|
|
|
|