Solved

call a function with a hyperlink

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This video discusses moving either the default database or any database to a new volume.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now