here my code-
<asp:TemplateField HeaderText="HIGH RISK (10-12)" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="lblHighrisk" runat="server" Text='<%# Eval("URANGE").ToString().Split('-')[0] %>' />
</ItemTemplate>
</asp:TemplateField>
but开发者_StackOverflow that is giving compile time error 'Server tag is not well formed'
Perhaps you have a problem with the quotation marks in the second split?
try
Text='<%# Eval("URANGE").ToString().Split("-")[0] %>'
does that help?
Update after comment Yes, that makes sense
Try reversing the quotation in that case
Text="<%# Eval'URANGE').ToString().Split('-')[0] %>"
does that help?
Try it without quotes:
<asp:Label ID="lblHighrisk" runat="server"
Text=<%# Eval("URANGE").ToString().Split('-')[0] %> />
It will be ok when you convert string "." to char and post it to split method.
Text='<%# Eval("costIntegerPart").ToString().Split(Convert.ToChar("."))[0] %>'
This will work
style='<%#Eval("cssHover").ToString().Split(new string[]{";"},StringSplitOptions.None)[0]%>'
精彩评论