Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Literal content ('<asp:ListItem Selected="') is not allowed within a 'System.Web.UI.WebControls.ListItemCollection'

Reply
Thread Tools

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

 
 
John Smith
Guest
Posts: n/a
 
      06-06-2006

This is what I am trying to do:

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

Public Function GetSelected(ByVal expectedCode As String, ByVal realCode As
String) As String
If expectedCode = realCode Then
Return "True"
Else
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: <aspropDownList id="cmbObdelaj" runat="server"
AutoPostBack="True"
Line 8: OnSelectedIndexChanged="DropDown_SelectedIndexChan ged">
Line 9: <asp:ListItem Selected="<%# GetSelected("P",
DataBinder.Eval(Container.DataItem, "S").ToString()) %>"
Value="P">PPPP</asp:ListItem>
Line 10: <asp:ListItem Selected="<%# GetSelected("D",
DataBinder.Eval(Container.DataItem, "S").ToString()) %>"
Value="D">DDDD</asp:ListItem>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Literal content is not allowed within a UserControl Ahsan Umair ASP .Net Web Controls 1 07-17-2008 10:09 PM
Literal content is not allowed within a CustomControl? Dave ASP .Net Building Controls 2 08-02-2006 07:45 PM
ERROR: Literal content ('<asp:ListItem Selected="') is not allowed within a 'System.Web.UI.WebControls.ListItemCollection' (REPOST) John Smith ASP .Net 0 06-07-2006 07:24 AM
Weird error - Literal content is not allowed within a 'skin file' Alan Silver ASP .Net 1 01-26-2006 10:43 PM
"Literal content is not allowed within a user control"? =?Utf-8?B?RGF2ZQ==?= ASP .Net 0 05-17-2004 03:21 AM



Advertisments