Solved

call a function with a hyperlink

Posted on 2006-07-14
5
585 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 500 total points
ID: 17113637
'<%# checkpackage (DataBinder.Eval(Container, "DataItem.apartmentid"),DataBinder.Eval(Container, "DataItem.packagename") ,DataBinder.Eval(Container, "DataItem.commname")) %>'
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

724 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