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 9305599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T23:57:56+00:00 2026-06-18T23:57:56+00:00

Hello I am binding Javascript Function with Asp.net linkButton. But i am facing the

  • 0

Hello I am binding Javascript Function with Asp.net linkButton.
But i am facing the issue with calling functionality of the Javascript function.

function AddToDatabase(url) {
     alert(url);
}

  <asp:LinkButton ID="lnkBtn" CommandName ="sendLink" runat="server" 
       OnClientClick='javascript:AddToDatabase("' <%# Eval("myUrl") %> '")'  
        CommandArgument='<%# Eval("myUrl") %>' Text='<%# Eval("myUrl") %>'>'
          <%# Eval("myUrl") %>'</asp:LinkButton>

It shows me error Server tag not well formed.

  • 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. Editorial Team
    Editorial Team
    2026-06-18T23:57:57+00:00Added an answer on June 18, 2026 at 11:57 pm
     <asp:LinkButton ID="lnkBtn" CommandName ="sendLink" runat="server" 
       OnClientClick='javascript:AddToDatabase(<%# Eval("myUrl") %>)'  
        CommandArgument='<%# Eval("myUrl") %>' Text='<%# Eval("myUrl") %>'>
       </asp:LinkButton>
    

    Edit 1

    change OnClientClick as follows

      OnClientClick='<%# Eval("myUrl", "javascript:AddToDatabase({0});") %>'
    

    combining both

       <asp:LinkButton ID="lnkBtn" CommandName ="sendLink" runat="server" 
                OnClientClick='<%# Eval("myUrl", "javascript:AddToDatabase({0});") %>' 
                CommandArgument='<%# Eval("myUrl") %>' Text='<%# Eval("myUrl") %>'>
      </asp:LinkButton>
    

    References

    Passing Eval parameter to a JavaScript function from ASPX file

    Edit 2

    Here is another link
    Passing variables to javascript in onclientclick
    passing a rowindex from gridview item click to javascript function

    Edit 3

    The one which helped answerer by the @moiz

       <asp:LinkButton ID="lnkBtn" CommandName ="sendLink" runat="server" 
            OnClientClick='<%# Eval("myUrl", "javascript:AddToDatabase(&#39;{0}&#39;);") %>' 
                     CommandArgument='<%# Eval("myUrl") %>' Text='<%# Eval("myUrl") %>'>
           '<%# Eval("myUrl") %>'
      </asp:LinkButton>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(defun foo () message hello) I want to binding the function foo to key
Hello I have an asp.net application where i am getting value from twitter and
I am reading this article - http://www.robertsosinski.com/2009/04/28/binding-scope-in-javascript/ - where a custom bind function is
Hello guys i have dataform in silverlight 4 project item source is: ItemsSource={Binding Data,
Hello! I've been programming for a long time but just started developing for android,
Hello all I am working on javascript jquery and svg.I want to ask a
Hello all I am working on html and javascript.And I am going to ask
Hello trying to get my binding to work over internet. im using wsHttpBinding and
Hello I have an issue deploying my silverlight project to an existing website (normal
Hello I have a Binding that I am using along with a converter, I

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.