Site Search:
Sign in | Join | Help

This Blog

4Penny offers domain names

Syndication

Tags

No tags have been created or used yet.

Archives

4Penny.net

Datagrid

Datagrid ItemDataBound event

Here is the 'starter code' that I use when creating the ItemDataBound event. It is not guaranteed to make sense, but exists so that I have sample code that I can alter to get a faster start.

 Protected Sub grdLines_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdLines.ItemDataBound
    If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then


        'get a reference to a data item
        Dim isRed As Integer = CType(DataBinder.Eval(e.Item.DataItem, "red"), String)


        'get a reference to a control...
        Dim lblLocncode As Label = e.Item.FindControl("lblLocncode")


    End If


End Sub

Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  
Add

About Steve Gray

Steve is a seasoned (translate: old) developer in VB and ASP.NET. He spends most of his time in Dynamics GP, writing custom mods for consulting firms. Crystal reports, eConnect, VS Tools for Dynamics... anything that comes along.