F
Fraggle
I have a class I wish to enter into a listbox
public Class AnswerListItem
Public Answer As String
Public Order As integer
End Class
Here is where I create the classes I wish to have in my box
dim AnswersDS as dataset
AnswersDS = QuestionDB.GetAnswersbyQuestion(dr("QuestionNo"))
dim drw as datarow
for each drw in answersDS.tables(0).rows
dim a as new answerlistitem()
a.Answer = "ans"
a.order = 3
answeritems.add(a)
next
AnswersList.datatextfield="Answer"
AnswersList.databind()
I get the error message " Exception Details: System.Web.HttpException:
DataBinder.Eval: 'ASPNetPortal.AnswerListItem' does not contain a
property with the name answer."
at Line 138:AnswersList.databind()
I tried changing to
AnswersList.datatextfield=DataBinder.Eval(container.DataItem,
"answer")
However, I get the error " Compiler Error Message: BC30451: Name
'container' is not declared."
If I comment out the AnswersList.datatextfield= line then I get the
right number of "ASPNetPortal.AnswerListItem"s in my listbox. So I
feel I am close!
Any help gratefully received!
If you need more code then ask!
Thanks
Fragg
public Class AnswerListItem
Public Answer As String
Public Order As integer
End Class
Here is where I create the classes I wish to have in my box
dim AnswersDS as dataset
AnswersDS = QuestionDB.GetAnswersbyQuestion(dr("QuestionNo"))
dim drw as datarow
for each drw in answersDS.tables(0).rows
dim a as new answerlistitem()
a.Answer = "ans"
a.order = 3
answeritems.add(a)
next
AnswersList.datatextfield="Answer"
AnswersList.databind()
I get the error message " Exception Details: System.Web.HttpException:
DataBinder.Eval: 'ASPNetPortal.AnswerListItem' does not contain a
property with the name answer."
at Line 138:AnswersList.databind()
I tried changing to
AnswersList.datatextfield=DataBinder.Eval(container.DataItem,
"answer")
However, I get the error " Compiler Error Message: BC30451: Name
'container' is not declared."
If I comment out the AnswersList.datatextfield= line then I get the
right number of "ASPNetPortal.AnswerListItem"s in my listbox. So I
feel I am close!
Any help gratefully received!
If you need more code then ask!
Thanks
Fragg