473,748 Members | 7,118 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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


This is what I am trying to do:

<asp:datagrid id="DataGrid1" runat="server" AutoGenerateCol umns="False">
<Columns>
<asp:BoundColum n Visible="False" DataField="id" ReadOnly="True"
HeaderText="ID" ></asp:BoundColumn >
<asp:TemplateCo lumn HeaderText="O">
<ItemTemplate >
<asp:DropDownLi st id="cmbObdelaj " runat="server" AutoPostBack="T rue"
OnSelectedIndex Changed="DropDo wn_SelectedInde xChanged">
<asp:ListItem Selected="<%# GetSelected("P" ,
DataBinder.Eval (Container.Data Item, "S").ToString() ) %>"
Value="P">PPPP</asp:ListItem>
<asp:ListItem Selected="<%# GetSelected("D" ,
DataBinder.Eval (Container.Data Item, "S").ToString() ) %>"
Value="D">DDDD</asp:ListItem>
</asp:DropDownLis t>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:datagrid >

Public Function GetSelected(ByV al 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.Lis tItemCollection '.
Source Error:
Line 7: <asp:DropDownLi st id="cmbObdelaj " runat="server"
AutoPostBack="T rue"
Line 8: OnSelectedIndex Changed="DropDo wn_SelectedInde xChanged">
Line 9: <asp:ListItem Selected="<%# GetSelected("P" ,
DataBinder.Eval (Container.Data Item, "S").ToString() ) %>"
Value="P">PPPP</asp:ListItem>
Line 10: <asp:ListItem Selected="<%# GetSelected("D" ,
DataBinder.Eval (Container.Data Item, "S").ToString() ) %>"
Value="D">DDDD</asp:ListItem>
Jun 6 '06 #1
0 2314

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
4037
by: Dave | last post by:
Can I create a user control so that when I drop it on the web form I can put text between the start and end tags as listed <uc1:KeyFeatures id="KeyFeatures1" runat="server" >test..</uc1:KeyFeatures Each one will have some lengthy text with bulleted lists, etc and I wanted this for readability. Can I set a property to accept this "innerText" as a value When I do this I get Literal content ('test..') is not allowed within a...
6
2469
by: Richard | last post by:
Dim index As Integer = lbSysteem.FindStringExact(strSysteem) basicly i want to return the value but as the examples show on the MSDN library, nothings wrong with the code? if FindStringExact isnt a member of Listbox then from what is it? thx in advance, Richard
20
5648
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just client-side HTML, CSS, etc. What I want to do is somehow insert a *server control* into the , then set the server control's properties at runtime.
3
2453
by: Brano | last post by:
HI all, I have a problem i have a web application that was working fine and this morning when i run it and click on a button that does Reponse.Redirect to a page i get this error : Server Error in '/IPFWEb_6' Application. -------------------------------------------------------------------------------- Object reference not set to an instance of an object.
6
6932
by: Joe | last post by:
I know that the Literal control will not render a <span> tag so I can not format its text. Other than this, what is the difference betwen the Literal control and the LiteralControl Control? How about a LiteralControl and a Label? Other than the lack of being able to format the Literal control's text, I don't see much of a difference in the documentation. TIA, --
1
3714
by: Alan Silver | last post by:
Hello, I am just converting a 1.1 web site to use version 2.0 of the framework and have run into a weird problem trying to add a skin file. I set up a theme, and moved the CSS file in there, no problem. I then changed one of the <img> tags in the master page to look like... <asp:Image ID="imgBsd" SkinId="imgBsd" runat="server" />
0
3332
by: John Smith | last post by:
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> <asp:DropDownList id="cmbObdelaj" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDown_SelectedIndexChanged">
7
2773
by: Jim in Arizona | last post by:
Using this: <asp:ListItem Value="0"</asp:ListItem> as long as I have a value listed and leave the area between the tags blank, when viewed the DropDownList will show a 0 as a choice. I want it to be blank. I've tried doing this: <asp:ListItem Value="0">&nbsp;</asp:ListItem>
4
2319
by: Neo Geshel | last post by:
Just moved to C# from VB.NET, frustrated to hell and back by inability to get much-copied (from about 20+ different resources) literal example to work. Master Page content: <meta name="keywords" content="<asp:Literal ID="ltrlKeywords" Runat="server" />"></meta> Code-Behind:
0
8984
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9530
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9312
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9238
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4593
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.