Error using Eval in asp.net
-
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
-
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
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