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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:36:37+00:00 2026-06-18T14:36:37+00:00

I am calling a jQuery Modal Dialog function from ASP.Net and I am passing

  • 0

I am calling a jQuery Modal Dialog function from ASP.Net and I am passing some parameters to it. One of the parameters contains a # symbol across and for this reason, the jQuery modal dialog call does not execute.

What’s the way to resolve this problem? I tried escaping the character by doing a replace of the string ‘#’ with this ‘\#’ but still doesn’t work out.

Thanks.

Code from the top of my head..

String var1 = "#3 and #4 should be on the list.";
lnkDetails.OnClientClick = "openDialog('" + var1 + "');

And the normal jQuery dialog function:

function openDialog(varPassed) {
            $("#divModal").dialog({
                width: 600,
            });

            $('#<%= label1.ClientID %>').text(varPassed);

Update: It seems the modal does not show up because of this line:

$('#<%= label1.ClientID %>').text(varPassed);

When the value being assigned to the label which is inside the div of the modal dialog itself, the modal window does not show up.

This is the modal window.

<div id="divMaterialDetails" title="Material Details" style="display:none" >
    <asp:Label ID="label1" runat="server" CssClass="formLabel"/>
</div>

If I commented out the assignment of the value, the modal shows up.

So how would I be able to assign the value passed to the modal to the label so that the modal would show up?

  • 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-18T14:36:38+00:00Added an answer on June 18, 2026 at 2:36 pm

    The # sign is not an issue at all. dialog method is not part of jQuery itself, but it is a part of jQuery UI. Did you include jQuery UI library as well, as compatible version of jQuery? Comment out/remove $("#divModal").dialog call and see if everything is fine. I tested this with and without this part and with this line it was not executing the line after the one that was causing error. When I included jQuery UI it started to work.

    In general, if you’re not sure what could be wrong with your code, try commenting out some parts you think may be causing problems as long as commenting something out/removing will fix the problem. It’s much easier to find out what’s going on by elimination of possible “trouble-makers” one by one. And, of course, use debugger – for Firefox the Firebug extention with JavaScript console is very usefull. You can read error messages that can lead you the the real source of the problem.

    And BTW, if you don’t want browser to follow clicked link, consider adding return false; to the OnClientClick like that:

    lnkDetails.OnClientClick = "openDialog('" + var1 + "');return false;";
    

    Check this question for more info about that.

    EDIT:

    My version available online:

    • Source at CodeRun

    Everything is in Default.aspx and Default.aspx.cs files, controls are created in Default.aspx.designer.cs. You can post your version via CodeRun to show us the context and other elements that may cause problems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone help? I have an issue with calling a asp.net webservice from jquery..
Here is some Html + jQuery ui dialog code genereated by asp.net for the
I'm calling an dialog from code behind and i've an asp:button. Now i'm trying
I have an HTML link that opens a jQuery modal dialog which contains an
How can I make an ASP.NET submit button postback while in jQuery UI dialog?
I'm trying to call an asp.net method using jquery/ajax from a button click on
I am using the jQuery Dialog in ASP.NET. I have it working fine with
I'm using jQuery autocomplete plugin from jQuery website calling the controller url which return
Am calling a webservice from my jQuery to fetch both Staff and Student details.
am calling a webservice from my jquery as $.ajax({ type: POST, url: /DataService.asmx/Search, contentType:

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.