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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:51:40+00:00 2026-05-22T12:51:40+00:00

i am running into a problem that i have a jquery modal popup in

  • 0

i am running into a problem that i have a jquery modal popup in my usercontrol that i show on a click of a button and user selects something from datalist and then i returned some value on the parent user control in a hidden field all is fine till here but after the click on the select button i want the jquery modal to be closed also
here is some code of the div which i show in modal diaog

<asp:UpdatePanel ID="upDatagrabber" runat="server">
<ContentTemplate>
    <table>
        <tr>
            <td>Select Category</td><td><asp:DropDownList ID="ddlTemplateCatagory" 
                runat="server" AutoPostBack="True"></asp:DropDownList></td>
        </tr>
        <tr>
            <td colspan="2">
                <table cellspacing="0" cellpadding="0" border="0" style="float:left;padding:5px;margin:5px;width:200px;display:block;">
                        <tbody>
                            <tr>
                                <asp:DataList ID="dlTemplates" runat="server" RepeatColumns="3" 
                                    RepeatDirection="Horizontal" onitemcommand="dlTemplates_ItemCommand">
                                    <ItemTemplate>
                                        <td style="border-right: gainsboro 1px solid; border-top: gainsboro 1px solid;
                                            border-left: gainsboro 1px solid; border-bottom: gainsboro 1px solid;padding:5px;">
                                            <table><tr><td>
                                            <%# Eval("NewsletterName").ToString()%>
                                            </td></tr>
                                            <tr><td><asp:Button ID="btnSelectNL_Template" Text="Select" runat="server" CssClass="button" CommandArgument='<%# Eval("NewsletterId").ToString()%>' CommandName="Select"/></td></tr>
                                            </table>
                                        </td>
                                    </ItemTemplate>
                                </asp:DataList>
                            </tr>
                        </tbody>
                 </table>
            </td>
        </tr>
    </table>
</ContentTemplate>

and in the ItemCommandEvent I tried following

protected void dlTemplates_ItemCommand(object source, DataListCommandEventArgs e)
    {
        if (e.CommandName == "Select")
        {
            int SelectedNewsletterId = int.Parse(e.CommandArgument.ToString());
            if (NewsletterSelectedHandler!= null)
            {
                                         e.Item.Attributes.Add("onclick","jQuery('#mydialog').dialog('close');");
                NewsletterSelectedHandler(SelectedNewsletterId);
            }
        }
    }

EDIT

i shown the popup using this in my code behind

ScriptManager.RegisterClientScriptBlock(this.Page, Page.GetType(), "change", "jQuery('#mydialog').dialog('open');closedialog = 1;jQuery('#mydialog').parent().appendTo(jQuery('form:aspnetForm'));", true);

popup shown successfully but i could not close it on the button click of datalist child button i tried code provided by tugburk i checked the error console also there is no error
code for close is as followd :

<script type="text/javascript">
$(document).ready(function(){

    $('#ctl00_ContentPlaceHolder1_NewsletterWizard1_TemplatePicker1_dlTemplates_ctl00_btnSelectNL_Template').click(function(){

      $('#mydialog').dialog('close');

    });

  });
</script>

Any help would be appreciable
Many thanks in the Advance

  • 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-22T12:51:41+00:00Added an answer on May 22, 2026 at 12:51 pm

    use the following code;

      $(document).ready(function(){
    
        $('#<%= btnSelectNL_Template.ClientID %>').click(function(){
    
          $('#id_of_your_dialog_element').dialog('close');
    
        });
    
      });
    

    EDIT :
    you are hardcoding your button id there;

    ctl00_ContentPlaceHolder1_NewsletterWizard1_TemplatePicker1_dlTemplates_ctl00_b‌​tnSelectNL_Template

    DataList will produce multiple buttons if you have multiple records. add a class name to that button, and try to write a code against it

    $('.MyButtonClass').click(function(){ 
        $('#mydialog').dialog('close'); 
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Running into the strangest problem on iPhone using jQuery with my WebViewController. I have
I have a .NET 2.0 server that seems to be running into scaling problems,
As a fairly junior developer, I'm running into a problem that highlights my lack
Running into a problem where on certain servers we get an error that the
The problem I'm running into is that as far as I know the delete
Here is the problem I'm running into. There's a huge legacy application that runs
I'm running into a problem where I have a simple add/edit form and using
I love jQuery but am running into a problem with larger site and multiple
I am running into a problem trying to use AJAX and jQuery with ASP.NET
Been running into this problem lately... When debugging an app in VS.Net 2005, breakpoints

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.