472,119 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

ERROR: Literal content ('<asp:ListItem Selected="') is not allowed within a 'System.Web.UI.WebControls.ListItemCollection' (REPOST)

This is what I am trying to do:

<asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False">
<asp:BoundColumn Visible="False" DataField="id" ReadOnly="True"
<asp:TemplateColumn HeaderText="O">
<asp:DropDownList id="cmbObdelaj" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="DropDown_SelectedIndexChan ged">
<asp:ListItem Selected="<%# GetSelected("P",
DataBinder.Eval(Container.DataItem, "S").ToString()) %>"
<asp:ListItem Selected="<%# GetSelected("D",
DataBinder.Eval(Container.DataItem, "S").ToString()) %>"

Public Function GetSelected(ByVal expectedCode As String, ByVal realCode As
String) As String
If expectedCode = realCode Then
Return "True"
Return "False"
End If
End Function

This is the error message:

Parser Error
Description: An error occurred during the parsing of a resource required to
service this request. Please review the following specific parse error
details and modify your source file appropriately.
Parser Error Message: Literal content ('<asp:ListItem Selected="') is not
allowed within a 'System.Web.UI.WebControls.ListItemCollection'.
Source Error:
Line 7: <asp:DropDownList id="cmbObdelaj" runat="server"
Line 8: OnSelectedIndexChanged="DropDown_SelectedIndexChan ged">
Line 9: <asp:ListItem Selected="<%# GetSelected("P",
DataBinder.Eval(Container.DataItem, "S").ToString()) %>"
Line 10: <asp:ListItem Selected="<%# GetSelected("D",
DataBinder.Eval(Container.DataItem, "S").ToString()) %>"

Any ideas?
Jun 7 '06 #1
0 3237

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by .Net Sports | last post: by
7 posts views Thread by Jim in Arizona | last post: by
reply views Thread by forumaic | last post: by
4 posts views Thread by Neo Geshel | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.