Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 154121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:55:21+00:00 2026-05-11T09:55:21+00:00

i have a bit of aspx code that uses Eval to generate a call

  • 0

i have a bit of aspx code that uses Eval to generate a call to a javascript function:

ASP.NET (wrapped for readability):

<asp:LinkButton runat='server'    OnClientClick='<%# Eval(          'NodeGUID',           'return DoStuff(this, \'{0}\');') %>'    Text='Do stuff' /> 

this generates javascript similar to:

Javascript (wrapped for readability):

return DoStuff(this,       '3F2504E0-4F89-11D3-9A0C-0305E82C3301'    ); 

Note: i’ve converted the generated &quot; entities references into quotes for readability.

i now need to add a 3nd parameter to the javascript function call, a caption:

Javascript (wrapped for readability)

return DoStuff(this,       '3F2504E0-4F89-11D3-9A0C-0305E82C3301',       'AllisonAngel.jpg'    ); 

Note: i’ve converted the generated &quot; entities references into quotes for readability.


There already exists a function in the code-behind file that is used to return the caption for an item:

C# (code omitted for readability):

protected string GetItemText(MySomething item) {    ... } 

i know that the above function can be called from the aspx file using a syntax similar to:

ASP.NET (wrapped, code omitted, for readability):

<asp:LinkButton ... runat='server'    Text='<%# GetItemText((MySomething)Container.DataItem) %>'     ... /> 

So now i want to use this function to include the 3rd parameter to the javascript function.

Starting from:

<asp:LinkButton runat='server'    OnClientClick='<%# Eval(          'NodeGUID',          'return DoStuff(this, \'{0}\', \'Todo - Insert caption here\');') %>'    Text='Do stuff' /> 

i need to change: ‘Todo - Insert caption here‘

into a call to: <%# GetItemText((MySomething)Container.DataItem) %>

Blindly trying the obvious:

ASP.NET (wrapped for readability):

<asp:LinkButton runat='server'    OnClientClick='<%# Eval(          'NodeGUID',           GetItemText((MySomething)Container.DataItem),          'return DoStuff(this, \'{0}\', \'{1}\');') %>'    Text='Do stuff' /> 

But that complains, since Eval() only takes two parameters.


i tried the slightly less obivous:

ASP.NET (wrapped for readability)

<asp:LinkButton runat='server'    OnClientClick='<%# Eval(          'NodeGUID',           'return DoStuff(this,                 \'{0}\',                 \''+GetItemText((MySomething)Container.DataItem)+'\');') %>'    Text='Do stuff' /> 

But that doesn’t work either.


Related Questions

ASP.NET: How to access repeater generated elements from javascript?

asp.NET: How to access repeater generated elements?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T09:55:22+00:00Added an answer on May 11, 2026 at 9:55 am

    The trick isn’t to pass multiple items to an eval, but to pass multiple eval’s to whatever you want to use to format the data. You could also have just done it this way – which would have kept the presentation in the aspx file like you wanted…

    <asp:LinkButton     runat='server'     OnClientClick='<%# string.Format(           'return DoStuff(this, \'{0}\', \'{1}\');',            Eval('NodeGUID'),            GetItemText((MySomething)Container.DataItem)) %>'     Text='Do stuff' /> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 152k
  • Answers 152k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Thanks all for your suggestions and responses - I think… May 12, 2026 at 10:07 am
  • Editorial Team
    Editorial Team added an answer Yes. Indexed view is basically another invisible table that gets… May 12, 2026 at 10:07 am
  • Editorial Team
    Editorial Team added an answer I have created a clean workspace with all settings i… May 12, 2026 at 10:07 am

Related Questions

I have a VS2008 solution containing two projects, a web service (the actual work
First and foremost let me state that I know that accessing server side controls
I've successfully been able to make elements (like div's, panel's, whatever) draggable by using
I'm a bit new to .Net development, been working in Java for some time

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.