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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:58:07+00:00 2026-05-11T18:58:07+00:00

I have a modal popup that has a targetId to a hidden button. I

  • 0

I have a modal popup that has a targetId to a hidden button. I want the popup to occur when a button in a grid is clicked but that button is programmed behind the code and therefore the targetId would be invalid…

So I wanted to attempt to set the gridview’s button’s onclientclick event to be the onclientclickevent of that hidden button. Is this possible or should I be going about this another way.

here is how i created the grid button

 If Not IsPostBack Then
        Dim field As New TemplateField
        field.HeaderText = "Sub Departments"
        Dim col As DataControlField = field
        GridView1.Columns.Add(col)

        For i As Integer = 0 To GridView1.Rows.Count - 1
            Dim btnview As New ImageButton
            btnview.ImageUrl = "\images\icons\xp_ico_search_24x24.gif"
            GridView1.Rows(i).Cells(3).Controls.Add(btnview)
        Next

End If
  • 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-11T18:58:08+00:00Added an answer on May 11, 2026 at 6:58 pm

    I am assuming you are using web forms. If so then yes, it it very possible.
    Do the following.

    1. Create a javascript function on the page

      function openModal(btnId){
          btn = document.getElementById(btnId);
          btn.click(); // this should fire the click even of the button
      }
      
    2. on the grid button add the onclientclick event:

      gridButton.OnClientClick = String.Format("openModal('{0}');", modalButton.ClientId))
      

    This will set the client Id of the button that trigers the modal window into the javascript function. If you need to populate the modal window with other data, you should do it in this function as well.

    Are you using the ASP.Net AJAX Control Toolkit? Or something else? This assumes the toolkit.

    Also, you have set the visibility of the button to hidden, but do not the the Visible=False property on the server side, as this will not render the button. To hide it you will need to use the client side property style="display:none"

    This link may help: http://forums.asp.net/t/1066506.aspx

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

Sidebar

Related Questions

I have a jqgrid in a modal popup that has data dependent on some
I have a Modal Popup Extender(MPE) , it has textboxes that are build dynamically
I have a modal popup with several links inside that have the :confirm and
I have a gridview that is only shown in a modal popup. right before
I'm using ajax requests to populate modal popup windows with data that users have
I have a JInternalFrame window that needs to popup a modal dialog box when
I have an ajax modal popup, which is shown on click of a button
I have a program where i use a modal popup that allows the user
So I want to bring in a modal view controller that has a UITextView
I have a modal popup which has different divs for different messages, now 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.