Click here to Skip to main content
15,891,431 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Question"Cannot apply indexing with [] to an expression of type 'System.Web.UI.WebControls.ListViewItem'" Pin
Member 387988129-Aug-08 17:56
Member 387988129-Aug-08 17:56 
AnswerWhy Repost? [modified] Pin
Manas Bhardwaj29-Aug-08 20:24
professionalManas Bhardwaj29-Aug-08 20:24 
AnswerRe: "Cannot apply indexing with [] to an expression of type 'System.Web.UI.WebControls.ListViewItem'" Pin
Manas Bhardwaj29-Aug-08 20:37
professionalManas Bhardwaj29-Aug-08 20:37 
QuestionWeird Issue Pin
kenexcelon29-Aug-08 17:51
kenexcelon29-Aug-08 17:51 
QuestionNeed Javascript logic for going to home page if history not present Pin
meeram39529-Aug-08 16:34
meeram39529-Aug-08 16:34 
AnswerRe: Need Javascript logic for going to home page if history not present Pin
Manas Bhardwaj29-Aug-08 20:43
professionalManas Bhardwaj29-Aug-08 20:43 
QuestionDynamically adding a control to a content page Pin
Cyberpulse29-Aug-08 14:41
Cyberpulse29-Aug-08 14:41 
QuestionReflection - GetValue question Pin
peacefulmember29-Aug-08 9:31
peacefulmember29-Aug-08 9:31 
Hi All,
Using Reflection I am trying to get properties of a class I have created. I am doing this, so I do not have to make coding changes with any additional property added to the class.

Getting the properties list is working but I am having trouble reading the value of the property. Not sure how and what parameters to be passed for GetValue funtion.

Could anybody please help me with GetValue statement?
Thanks in Advance!

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
	Dim Members As Collection = Family.Members()
        For i As Integer = 1 To sqlColl.Count
	GetMemberInfo()
        Next

    End Sub

Sub GetMemberInfo()
	Dim oMember As New Member
        Dim objType As Type = oMember.GetType()
        Dim sName As String, svalue As Object
        'Dim properties As System.Reflection.PropertyInfo() = objType.GetProperties()
        For Each srcProperty As System.Reflection.PropertyInfo In objType.GetProperties()
            sName = srcProperty.Name
            svalue = srcProperty.GetValue(oMember , Nothing)
            Response.Write(i & " - " & sName & (svalue Is Nothing) & "<br />")
        Next
End Sub


'Classes are like

Public Class Member
    Private _name As String
    Private _age As Integer
    
    Public Property Name() As String
        Get
            Return _Name
        End Get
        Set(ByVal value As String)
            _Name = value
        End Set
    End Property
    Public Property Age() As Integer
        Get
            Return _age
        End Get
        Set(ByVal value As Integer
            _age = value
        End Set
    End Property
End Class

Public Class Family
    Private Shared MemberCollection As Collection = Nothing
    Shared Sub AddMember(ByVal Info As Member)
        Dim thisFamily As New Family
        thisFamily.AddToCollection(Info)
    End Sub
    Private Sub AddToCollection(ByVal Info As Member)
        If MemberCollection Is Nothing Then MemberCollection = New Collection
        MemberCollection .Add(Info)
    End Sub
    
   Shared Function Members() As Collection
        Dim thisFamily As New Family
        Return thisFamily.getMembersColl()
    End Function
    Private Function getMembersColl() As Collection
        Return MemberCollection
    End Function
    Shared Function getCount() As Integer
        Return Members.Count
End Class

QuestionConfigurarion error: Pin
salmonraju29-Aug-08 8:55
salmonraju29-Aug-08 8:55 
QuestionFile system object Pin
soorma29-Aug-08 6:22
soorma29-Aug-08 6:22 
AnswerRe: File system object Pin
Expert Coming29-Aug-08 8:07
Expert Coming29-Aug-08 8:07 
Questionprobleam concatenate string in asp.net Pin
Rinki Mukheraji29-Aug-08 3:28
Rinki Mukheraji29-Aug-08 3:28 
AnswerRe: probleam concatenate string in asp.net Pin
Abhijit Jana29-Aug-08 3:31
professionalAbhijit Jana29-Aug-08 3:31 
GeneralRe: probleam concatenate string in asp.net Pin
Rinki Mukheraji29-Aug-08 3:37
Rinki Mukheraji29-Aug-08 3:37 
GeneralRe: probleam concatenate string in asp.net Pin
Abhijit Jana29-Aug-08 3:50
professionalAbhijit Jana29-Aug-08 3:50 
GeneralRe: probleam concatenate string in asp.net Pin
Rinki Mukheraji29-Aug-08 3:41
Rinki Mukheraji29-Aug-08 3:41 
GeneralRe: probleam concatenate string in asp.net Pin
Abhijit Jana29-Aug-08 3:55
professionalAbhijit Jana29-Aug-08 3:55 
AnswerRe: probleam concatenate string in asp.net Pin
Manas Bhardwaj29-Aug-08 3:44
professionalManas Bhardwaj29-Aug-08 3:44 
GeneralRe: probleam concatenate string in asp.net Pin
Rinki Mukheraji29-Aug-08 3:48
Rinki Mukheraji29-Aug-08 3:48 
AnswerRe: probleam concatenate string in asp.net Pin
Abhishek Sur29-Aug-08 3:46
professionalAbhishek Sur29-Aug-08 3:46 
GeneralRe: probleam concatenate string in asp.net Pin
Rinki Mukheraji29-Aug-08 3:51
Rinki Mukheraji29-Aug-08 3:51 
GeneralRe: probleam concatenate string in asp.net Pin
Abhijit Jana29-Aug-08 3:52
professionalAbhijit Jana29-Aug-08 3:52 
GeneralRe: probleam concatenate string in asp.net Pin
Rinki Mukheraji29-Aug-08 3:57
Rinki Mukheraji29-Aug-08 3:57 
GeneralRe: probleam concatenate string in asp.net Pin
Abhijit Jana29-Aug-08 4:00
professionalAbhijit Jana29-Aug-08 4:00 
GeneralRe: probleam concatenate string in asp.net Pin
Abhijit Jana29-Aug-08 4:02
professionalAbhijit Jana29-Aug-08 4:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.