Solved

call a function with a hyperlink

Posted on 2006-07-14
5
584 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 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