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

  • Home
  • SEARCH
  • 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 6870093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:38:25+00:00 2026-05-27T03:38:25+00:00

I have a data source that I can not alter , the data source

  • 0

I have a data source that I can not alter, the data source contains a hyperlink with an Id in it that I can use to retrieve data that I need. I created a method to convert the hyperlink to call a javascript function and pass the scrubbed id from the hyperlink, however I am not getting the correct results. In its current state everything is working except the insertion of the id var into the ClickIt method. For this example the value of id is djb137, and when I click on the new hyperlink the error returned is ‘djb137 is undefined. Am I overlooking something on passing a paramater to a javascript function?

private string ScrubHref(string statementHtml)
    {
        string pattern = "href.*?\"(?<href>.*?)\"";

        return Regex.Replace(statementHtml, pattern, delegate(Match match)
        {
            string v = match.ToString();

            string id = Regex.Match(v, "\"([^\"]*?)\"").Groups[1].Value;

            string returnValue = "href=\"#\"" + "onclick=\"return ClickIt("+id+");\"";

            return returnValue;
        });
    }

Intrestingly If I change the retrunValue string to this

return v + "onclick=\"return ClickIt(this.href);\"";

Then my javascript function gets the whole href passed to it without issue.But I just need the Id not the whole href.

  • 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-05-27T03:38:26+00:00Added an answer on May 27, 2026 at 3:38 am

    You need to quote your id as you pass it in to your function call.

    The line

    string returnValue = "href=\"#\"" + "onclick=\"return ClickIt("+id+");\"";
    

    Should be

    string returnValue = "href=\"#\"" + "onclick=\"return ClickIt('"+id+"');\"";
    

    What’s happening is it thinks djb137 is a variable name, think how the method calls would look if you weren’t constructing them in this way. What’s the difference between the following

    return ClickIt(djb137); // looks like a variable identifier
    
    return ClickIt('djb137'); // passing a string to the function call
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data source with about 2000 lines that look like the following:
I have a repeater that's bound to a SQL Data Source (using ASP.NET). Are
I have a small application that uses a SharePoint list as the data source.
I have a C program that mines a huge data source (20GB of raw
I have a data frame in R that looks like this: > TimeOffset, Source,
I have a Django app that gets it's data completely from an external source
I have a number of different data sources that I need to query and
I have source folder test , in what there is package Resources.Data , that
I have some data that comes regularily as a dump from a data souce
So I have learned that that the Microsoft.Jet.OLEDB.4.0 data provider for querying data sources

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.