[thelist] ASP.NET: Binding DataRows to a Repeater

Edward McCarroll Ed at ComSimplicity.com
Thu Apr 2 13:56:36 CDT 2009


Blake,

As a .Net programmer, it's great so see an occasional .Net post on
this list.  But the resource I find most helpful with .Net questions
is the ASP.Net forums at:  http://forums.asp.net/

I do something similar when I use VB.Net to bind a SqlDataReader to
a GridView.  In that case I manipulate values in my controls using
statements that get raw data from HiddenFields using code like this
in the GridView.RowDataBound event handler:

CType(e.Row.FindControl("cmdEdit"), LinkButton).CommandArgument = _
    CType(e.Row.FindControl("hdnIndividualId"), HiddenField).Value

And just in case you speak VB as badly as I speak C#:

- e is the GridViewRowEventArgs passed to the event handler
- CType() casts a generic Control to a more specific type of control
- FindControl() finds a Control object in the row just bound
- "cmdEdit" is the ID of a button whose .CommandArgument I'm setting
- "hdnIndividualId" is the ID of a HiddentField containing raw data

HTH,

"Expletive Deleted!" (Richard M. Nixon)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ed McCarroll                                     Ed at ComSimplicity.com
PO Box 654                                             (310) 904-3651
Culver City, CA 90232                           www.ComSimplicity.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -




More information about the thelist mailing list