I have “Question” and “QuestionTypes”. In “Question” table there is a foreign key that refrence the other table. I want to show question attributes with type name.
Repeater code:
<ItemTemplate>
<tr>
<td>
<%#Eval("QuestionSubject")%>
</td>
<td>
<%#Eval("Question")%>
</td>
<td>
<%#Eval("QuestionTypeName")%> //I want to get question typename
</td> //TypeName is in other table
</tr>
</ItemTemplate>
And here is code behind:
private IEnumerable<TableSurveyQuestion> Questions()
{
int survey_id = Int32.Parse(Request.QueryString["survey_id"]);
IEnumerable<TableSurveyQuestion> questions= db.TableSurveyQuestions.Where(a => a.SurveyId == survey_id);
return questions;
}
I bind this founction to repeater data source.
I tried select new TableQuestions {typeName=x.TableQuestionTypes.TypeName} but this did not work.
In mvc I get it like this question.TableQuestionType.TypeName. How do this in ASP.NET web forms.
Thanks.
I found it
thanks.