J
John Smith
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_SelectedIndexChanged">
<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_SelectedIndexChanged">
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>
Any ideas?
<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_SelectedIndexChanged">
<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_SelectedIndexChanged">
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>
Any ideas?