?
Solved

call a function with a hyperlink

Posted on 2006-07-14
5
Medium Priority
?
588 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 total points
ID: 17113637
'<%# checkpackage (DataBinder.Eval(Container, "DataItem.apartmentid"),DataBinder.Eval(Container, "DataItem.packagename") ,DataBinder.Eval(Container, "DataItem.commname")) %>'
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month13 days, 2 hours left to enroll

777 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