Buondì a tutti, dovrebbe essere la sezione giusta ero indeciso se qui o Database.
Dunque ho una list (of miaclasse) chiamata ListaNews .
Ora l'ho implementata da DB , vorrei importare solo 3 news nella homepage ordinandole per impression (dal più piccolo al più grande) e spedirlo al repeater.codice:Public Class LcNews Private _idx As Int16 Public Property Id() As Int16 Get Return _idx End Get Set(ByVal value As Int16) _idx = value End Set End Property Private _Cat1 As String Public Property Cat1() As String Get Return _Cat1 End Get Set(ByVal value As String) _Cat1 = value End Set End Property Private _Cat2 As String Public Property Cat2() As String Get Return _Cat2 End Get Set(ByVal value As String) _Cat2 = value End Set End Property Private _titolo As String Public Property Titolo() As String Get Return _titolo End Get Set(ByVal value As String) _titolo = value End Set End Property Private _testoarticolo As String Public Property Testoarticolo() As String Get Return _testoarticolo End Get Set(ByVal value As String) _testoarticolo = value End Set End Property Private _di As String Public Property Di() As String Get Return _di End Get Set(ByVal value As String) _di = value End Set End Property Private _df As String Public Property Df() As String Get Return _df End Get Set(ByVal value As String) _df = value End Set End Property Private _Inserzionista As String Public Property Inserzionista() As String Get Return _Inserzionista End Get Set(ByVal value As String) _Inserzionista = value End Set End Property Private _Id As Int16 Public Property Idx() As Int16 Get Return _Id End Get Set(ByVal value As Int16) _Id = value End Set End Property Private _Impressions As Int16 Public Property Impressions() As Int16 Get Return _Impressions End Get Set(ByVal value As Int16) _Impressions = value End Set End Property Private _click As Int16 Public Property Clickx() As Int16 Get Return _click End Get Set(ByVal value As Int16) _click = value End Set End Property Private _Datacreato As String Public Property Datacreato() As String Get Return _Datacreato End Get Set(ByVal value As String) _Datacreato = value End Set End Property Private _Datacancellato As String Public Property DataCancellato() As String Get Return _Datacancellato End Get Set(ByVal value As String) _Datacancellato = value End Set End Property Private _immagine As String Public Property Immagine() As String Get Return _immagine End Get Set(ByVal value As String) _immagine = value End Set End Property Private _visibile As Boolean Public Property Visibilex() As Boolean Get Return _visibile End Get Set(ByVal value As Boolean) _visibile = value End Set End Property End Class
Non riesco ad ordinarlo, quando lo invio al repeater visualizza sempre dall'id più basso
Anche una semplice Select funziona così :codice:Dim result = (From i In Global_asax.ListaNews Order By i.Impressions Ascending).Take(3).ToList RpNews.DataSource = result Ecc ecc...
codice funzionantecodice:result = (From i In Global_asax.ListaNews Where i.Idx = 39)
Non funzionante , il campo visible in tabella è bit.codice:result = (From i In Global_asax.ListaNews Where i.visiblex= true )
Ho provate varie combinazioni, ma non capisco primo perchè non le mette infila per "impressions" sempre e solo per ID, poi le seleziona solo per Idx e non per altri campi come "Visiblex".codice:result = (From i In Global_asax.ListaNews Where i.visiblex = 1)
Grazie a tutti.

.
Rispondi quotando