Solved

call a function with a hyperlink

Posted on 2006-07-14
5
582 Views
Last Modified: 2012-08-13
I am working on a website in asp.net 1.1/vb.net.   I need to use a hyperlink inside a datagrid that will call a function on the code behind. I have come up with this so far:

checkpackage (eval("apartmentid"),eval("packagename"), eval("commname")) is what I am using in the navigateurl part of the databind.

This is the code behind:

Public Function checkpackage(ByVal id As Object, ByVal package As Object, ByVal commname As Object) As String
        If package.ToString() = "aptbasic" Then
            Return "aptbasic.aspx?id=" + id.ToString()
        ElseIf package.ToString = "aptint" Then
            Return "/" + commname.ToString()
        ElseIf package.ToString = "aptult" Then
            Return "/" + commname.ToString()
        ElseIf package.ToString = "singlead" Then
            Return "aptsingle.aspx?id=" + id.ToString()
        ElseIf package.ToString = "multint" Then
            Return "aptmult.aspx?id=" + id.ToString()
        ElseIf package.ToString = "multbasic" Then
            Return "aptsingle.aspx?id=" + id.ToString
        Else
            Return "aptmult.aspx?id=" + id.ToString

        End If
    End Function

I keep getting the error that "eval isn't declared."  I thought you could use eval for this purpose.  Anyone have any idea what I am doing wrong?
0
Comment
Question by:smith68349
  • 3
5 Comments
 
LVL 7

Expert Comment

by:pradeepsudharsan
ID: 17113569
Use '<%# DataBinder.Eval(Container, "DataItem.apartmentid") %>',
 '<%# DataBinder.Eval(Container, "DataItem.packagename") %>',
 '<%# DataBinder.Eval(Container, "DataItem.commname") %>'
0
 
LVL 7

Expert Comment

by:pradeepsudharsan
ID: 17113598
checkpackage ( '<%# DataBinder.Eval(Container, "DataItem.apartmentid") %>',
 '<%# DataBinder.Eval(Container, "DataItem.packagename") %>',
 '<%# DataBinder.Eval(Container, "DataItem.commname") %>')
0
 
LVL 7

Accepted Solution

by:
pradeepsudharsan earned 500 total points
ID: 17113637
'<%# checkpackage (DataBinder.Eval(Container, "DataItem.apartmentid"),DataBinder.Eval(Container, "DataItem.packagename") ,DataBinder.Eval(Container, "DataItem.commname")) %>'
0

Featured Post

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question