'System.Data.DataRowView' does not contain a property with the name 'Title'. when using itemTemplat

R

rote

I don't know what i'm doing wrong but i can't get the
<asp:Label ID="Label3" Text='<%# Eval("Title") %>' Runat="Server"/>
in my itemplate to work.
The Select statement is right and it returns data and it also works in EDit
Mode.
But when i use the label with the Title i get the error.

If i type in another property lets say title_id it does work

Any ideas?



<asp:TemplateField HeaderText="Title">

<ItemTemplate>

<asp:Label ID="Label3" Text='<%# Eval("Title") %>' Runat="Server"/>

</ItemTemplate>

<EditItemTemplate>

<asp:DropDownList id="ddlTitle" runat="server"

DataSourceID="sqlDS2"

BackColor="Pink"

DataTextField="Title" DataValueField="Title_ID"

SelectedValue='<%# Bind("Title_ID") %>'>

</asp:DropDownList>

</EditItemTemplate>

</asp:TemplateField>



<asp:SqlDataSource ID="sqlDS2"

Runat="Server"

SelectCommand = "SELECT [Title] FROM [Employee_T] ORDER BY Title"

DataSourceMode="DataSet"

ConnectionString="<%$ ConnectionStrings:MwcConnectionString %>">

</asp:SqlDataSource>
 
R

rote

Yeah thanks Eliyahu figured that out already

Eliyahu Goldin said:
DataSourceID="sqlDS2" is set for the dropdown list. It has nothing to do
with the datasource for the detailsview. Apparently, the datasource you
are using for the detailsview doesn't contain a Title column.


--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


rote said:
I don't know what i'm doing wrong but i can't get the
<asp:Label ID="Label3" Text='<%# Eval("Title") %>' Runat="Server"/>
in my itemplate to work.
The Select statement is right and it returns data and it also works in
EDit Mode.
But when i use the label with the Title i get the error.

If i type in another property lets say title_id it does work

Any ideas?



<asp:TemplateField HeaderText="Title">

<ItemTemplate>

<asp:Label ID="Label3" Text='<%# Eval("Title") %>' Runat="Server"/>

</ItemTemplate>

<EditItemTemplate>

<asp:DropDownList id="ddlTitle" runat="server"

DataSourceID="sqlDS2"

BackColor="Pink"

DataTextField="Title" DataValueField="Title_ID"

SelectedValue='<%# Bind("Title_ID") %>'>

</asp:DropDownList>

</EditItemTemplate>

</asp:TemplateField>



<asp:SqlDataSource ID="sqlDS2"

Runat="Server"

SelectCommand = "SELECT [Title] FROM [Employee_T] ORDER BY Title"

DataSourceMode="DataSet"

ConnectionString="<%$ ConnectionStrings:MwcConnectionString %>">

</asp:SqlDataSource>
 
R

rote

Eliyahu,
My other questions is regarding DetailsView is
can i use html tables in DetailsView control
I want to format the view to have more than 2 columns and i would be having
update,Edit features too..
Any ideas on this?

Eliyahu Goldin said:
DataSourceID="sqlDS2" is set for the dropdown list. It has nothing to do
with the datasource for the detailsview. Apparently, the datasource you
are using for the detailsview doesn't contain a Title column.


--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


rote said:
I don't know what i'm doing wrong but i can't get the
<asp:Label ID="Label3" Text='<%# Eval("Title") %>' Runat="Server"/>
in my itemplate to work.
The Select statement is right and it returns data and it also works in
EDit Mode.
But when i use the label with the Title i get the error.

If i type in another property lets say title_id it does work

Any ideas?



<asp:TemplateField HeaderText="Title">

<ItemTemplate>

<asp:Label ID="Label3" Text='<%# Eval("Title") %>' Runat="Server"/>

</ItemTemplate>

<EditItemTemplate>

<asp:DropDownList id="ddlTitle" runat="server"

DataSourceID="sqlDS2"

BackColor="Pink"

DataTextField="Title" DataValueField="Title_ID"

SelectedValue='<%# Bind("Title_ID") %>'>

</asp:DropDownList>

</EditItemTemplate>

</asp:TemplateField>



<asp:SqlDataSource ID="sqlDS2"

Runat="Server"

SelectCommand = "SELECT [Title] FROM [Employee_T] ORDER BY Title"

DataSourceMode="DataSet"

ConnectionString="<%$ ConnectionStrings:MwcConnectionString %>">

</asp:SqlDataSource>
 
E

Eliyahu Goldin

The DetailsView presents one field in a row. It is not good for what you
want. User the FormView instead.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin


rote said:
Eliyahu,
My other questions is regarding DetailsView is
can i use html tables in DetailsView control
I want to format the view to have more than 2 columns and i would be
having update,Edit features too..
Any ideas on this?

Eliyahu Goldin said:
DataSourceID="sqlDS2" is set for the dropdown list. It has nothing to do
with the datasource for the detailsview. Apparently, the datasource you
are using for the detailsview doesn't contain a Title column.


--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


rote said:
I don't know what i'm doing wrong but i can't get the
<asp:Label ID="Label3" Text='<%# Eval("Title") %>' Runat="Server"/>
in my itemplate to work.
The Select statement is right and it returns data and it also works in
EDit Mode.
But when i use the label with the Title i get the error.

If i type in another property lets say title_id it does work

Any ideas?



<asp:TemplateField HeaderText="Title">

<ItemTemplate>

<asp:Label ID="Label3" Text='<%# Eval("Title") %>' Runat="Server"/>

</ItemTemplate>

<EditItemTemplate>

<asp:DropDownList id="ddlTitle" runat="server"

DataSourceID="sqlDS2"

BackColor="Pink"

DataTextField="Title" DataValueField="Title_ID"

SelectedValue='<%# Bind("Title_ID") %>'>

</asp:DropDownList>

</EditItemTemplate>

</asp:TemplateField>



<asp:SqlDataSource ID="sqlDS2"

Runat="Server"

SelectCommand = "SELECT [Title] FROM [Employee_T] ORDER BY Title"

DataSourceMode="DataSet"

ConnectionString="<%$ ConnectionStrings:MwcConnectionString %>">

</asp:SqlDataSource>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top