Read RowCount from LLBLGenProDataSource with LivePersistence="True"

Posts   
 
    
trevorg
User
Posts: 104
Joined: 15-Nov-2007
# Posted on: 02-Mar-2010 23:43:20   

Is it possible to read the RowCount from a LLBLGenProDataSource (self servicing) with LivePersistence="True"??

On an aspx form, I am setting the FilterToUse property on my data control, so after the data is fetched, if there are 0 rows, I need to do a .ChangeMode(FormViewMode.Insert) on my FormView control

I'd rather stick with LivePersistence=True.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 03-Mar-2010 07:38:46   

Hace you tried onENtityFetched?

David Elizondo | LLBLGen Support Team
trevorg
User
Posts: 104
Joined: 15-Nov-2007
# Posted on: 17-Mar-2010 23:25:28   

This is how I ended up doing it.

But now there are other issues (will make a new thread).

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If IsPostBack Then Exit Sub
        'this label text fixing won't work until the html labels are changed to asp:label's
        'Dim allControls As System.Collections.Generic.List(Of Control) = Talisman.Core.Web.WebUtils.ChildControls(Me.frmEdit, GetType(Label))

        Dim qFilter As New PredicateExpression
        qFilter.AddWithAnd(MetricFields.MetricCode = Request.QueryString("MetricCode"))

        Me.Filter = qFilter
        Me.frmEdit.DataBind()
        If Me.frmEdit.DataItemCount = 0 OrElse Me.llbDataSource.EntityCollection(0).IsNew Then
            'If Me.frmEdit.DataItemCount = 0 Then
            If Request.QueryString(frmEdit.DataKeyNames(0)) <> "" Then Throw New System.Exception(String.Format("Record not found for {0} = {1}", frmEdit.DataKeyNames(0), Request.QueryString(frmEdit.DataKeyNames(0))))
            Me.frmEdit.ChangeMode(FormViewMode.Insert)
        ElseIf frmEdit.DataItemCount = 1 Then
            Me.frmEdit.ChangeMode(FormViewMode.Edit)
        End If

    End Sub