dotnet3.5,llblgen 2.6,vb.net,asp.net
Trying to do some row manipulation but cannot retrieve the dataitem properties, the e.row.dataitem is returning an anonymous type instead of the VwTripDomesticCountEntity...does this mean i should avoid Linq and use the standard way to run queries?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Using adapter As New DataAccessAdapter()
Dim metaData As New LinqMetaData(adapter)
Dim qDomestic = From p In metaData.VwTripDomesticCount _
Where p.FromCountryId = Integer.Parse(Session("YourCountryId")) _
Select p.FromStateId, p.FromState, p.Count
GridViewDomestic.DataSource = qDomestic
GridViewDomestic.DataBind()
End Using
End If
End Sub
Protected Sub GridViewDomestic_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridViewDomestic.RowDataBound
Dim sRowHTML As String = "sdssssfsdfs"
If e.Row.RowType = DataControlRowType.DataRow Then
Dim c As VwTripDomesticCountEntity = e.Row.DataItem
sRowHTML = CType(e.Row.DataItem, VwTripDomesticCountEntity).FromCountry & CType(e.Row.DataItem, VwTripDomesticCountEntity).FromState 'NOT WORKING
e.Row.Cells(1).Text = sRowHTML
End If
End Sub