C
C.R.
I have a formview using a datasource and it works just fine in its basic
format. However, I have some foreign keys I want to dispay the description
for instead of the key value - just like I do in my gridview. In the
gridview I use the standard template field as follows:
<asp:TemplateField HeaderText="District" SortExpression="District.Name">
<ItemTemplate>
<%#Eval("District.Name")%>
</ItemTemplate>
</asp:TemplateField>
However when I try something similar in the formview I get no value
displayed for the name:
<asp:Label ID="Label1" runat="server" Text='<%# Eval("District.Name") %>' />
I tried the dropdown list approach using a linqdatasource with Districts to
handle it (I will want the dropdown in the edit and insert templates - but I
don't need it in the itemtemplate). When I do this I get the error that it
can't use a declaritive datasource. I am able to get the dropdown approach
shown here http://www.mikepope.com/blog/DisplayBlog.aspx?permalink=1423 by
using a sqldatasource, but I was hoping to use the linq approach and not have
a dropdown on the itemtemplate.
What is the recommended approach for what I am trying to do?
Thank you in advance.
C.R. Cook
format. However, I have some foreign keys I want to dispay the description
for instead of the key value - just like I do in my gridview. In the
gridview I use the standard template field as follows:
<asp:TemplateField HeaderText="District" SortExpression="District.Name">
<ItemTemplate>
<%#Eval("District.Name")%>
</ItemTemplate>
</asp:TemplateField>
However when I try something similar in the formview I get no value
displayed for the name:
<asp:Label ID="Label1" runat="server" Text='<%# Eval("District.Name") %>' />
I tried the dropdown list approach using a linqdatasource with Districts to
handle it (I will want the dropdown in the edit and insert templates - but I
don't need it in the itemtemplate). When I do this I get the error that it
can't use a declaritive datasource. I am able to get the dropdown approach
shown here http://www.mikepope.com/blog/DisplayBlog.aspx?permalink=1423 by
using a sqldatasource, but I was hoping to use the linq approach and not have
a dropdown on the itemtemplate.
What is the recommended approach for what I am trying to do?
Thank you in advance.
C.R. Cook