Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Error using Eval in asp.net

Error using Eval in asp.net

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netcomhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vimalsoft Pty Ltd
    wrote on last edited by
    #1

    Good Day all i have the following

    <%# clsFlow.CleanBondNumber(Eval("ATB_NUMBER"))%>

    and the Function CleanBondNumber is defined like this

    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 <%# clsFlow.CleanBondNumber(Eval("ATB_NUMBER"))%> '=' expected. Thanks

    Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa[at]dotnetfunda.com http://www.Dotnetfunda.com

    A 1 Reply Last reply
    0
    • V Vimalsoft Pty Ltd

      Good Day all i have the following

      <%# clsFlow.CleanBondNumber(Eval("ATB_NUMBER"))%>

      and the Function CleanBondNumber is defined like this

      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 <%# clsFlow.CleanBondNumber(Eval("ATB_NUMBER"))%> '=' expected. Thanks

      Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa[at]dotnetfunda.com http://www.Dotnetfunda.com

      A Offline
      A Offline
      Anuj Banka
      wrote on last edited by
      #2

      CommandName='<%# GetCommandNamebunit(Container.DataItem) %>'

      And in code behind

      Function GetCommandNamebunit(ByVal dataItem As Object) As String
          GetCommandNamebunit = "demotext"
          GetCommandNamebunit = String.Empty
          Dim texpinnerText = DirectCast(dataItem, Object).texp
          Dim bunitinnerText = DirectCast(dataItem, Object).bunit
          Dim rexpinnerText = DirectCast(dataItem, Object).rexp
          Dim bunitid = DirectCast(dataItem, Object).id
          Dim Str\_blevel
          Dim str\_alig
          Dim str\_TFrame
          Dim str\_bunit
          Dim str\_fiscalY
          Str\_blevel = sltBusinessLevel.SelectedValue
          str\_alig = sltAlignmentLevel.SelectedValue
          str\_TFrame = sltTimeFrame.SelectedValue
          str\_bunit = sltBusinessUnit.SelectedValue
          str\_fiscalY = sltFiscalYear.SelectedValue
          If str\_alig = 1 Then
              If Str\_blevel < 4 Then
                  If texpinnerText <> "0" Then
                      GetCommandNamebunit = "sendModuleValues"
                  End If
              Else
                  If texpinnerText <> "0" Then
                      GetCommandNamebunit = "setonefacility"
                  End If
              End If
          Else
              If Str\_blevel < 3 Then
                  If texpinnerText <> "0" Then
      
                      GetCommandNamebunit = "sendModuleValues"
                  End If
              Else
                  If texpinnerText <> "0" Then
                      GetCommandNamebunit = "setonefacility"
                  End If
              End If
          End If
      End Function
      

      This is working fine for you can take help from this.

      Anuj

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups