Results 1 to 3 of 3

Thread: Error using Eval in asp.net

  1. #1

    Thread Starter
    Fanatic Member vuyiswamb's Avatar
    Join Date
    Jan 2007
    Location
    South Africa
    Posts
    830

    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

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    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?
    Last edited by sapator; Nov 14th, 2011 at 07:29 PM.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  3. #3
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width