Error using Eval in asp.net
Good Day all
i have the following
Code:
<%# clsFlow.CleanBondNumber(Eval("ATB_NUMBER"))%>
and the Function CleanBondNumber is defined like this
Code:
Public Shared Function CleanBondNumber(ByVal val As Object) As String
Dim Final_bond_acc_no As String = String.Empty
If (val.ToString().Contains("Offer")) Then
'Get rid of the Offer string
Dim Finalstring As String
Finalstring = val.ToString.Substring(6)
If (Finalstring.Contains(" ")) Then
'Get the Position of the Space
Dim SpacePost As Integer
SpacePost = Finalstring.IndexOf(" ")
Final_bond_acc_no = Finalstring.Substring(0, SpacePost - 1)
Return Final_bond_acc_no
Else
Return val.ToString()
End If
Else
If (val.Contains(" ")) Then
'Get the Position of the Space
Dim SpacePost As Integer
SpacePost = val.IndexOf(" ")
Final_bond_acc_no = val.Substring(0, SpacePost - 1)
Return Final_bond_acc_no
Else
Return val.ToString()
End If
End If
End Function
i stepped through the code and after it returns something i cant bind the Data, i get an Exception
Code:
<%# clsFlow.CleanBondNumber(Eval("ATB_NUMBER"))%> '=' expected.
Thanks
Re: Error using Eval in asp.net
Hi.Please be more specific.
Are you assigning this to a control?It's not obligatory to use eval, i think fror what i see that you don't need eval.
What are you trying?Where are you binding this?What is you markup part that you bind this?
Re: Error using Eval in asp.net
vuyiswamb,
If I had to make a suggestion, it would be that you don't use the Eval, and instead, do the work that you want in the Code Behind, not in the ASPX markup.
Gary