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

  • Iterate through an ASP.NET datagrid

    Here's how to loop through an ASP.NET datagrid

    Dim a As Int16
    For a = 0 To Me.grdLines.Items.Count - 1
        'get a reference to the row id
        intDexRowID = CType(Me.grdLines.Items(a).FindControl("lblDexRowID"), Label).Text
    Next

  • 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