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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:06:28+00:00 2026-05-27T06:06:28+00:00

I have to display a popup when user clicks on Place button inside a

  • 0

I have to display a popup when user clicks on Place button inside a gridview and please remeber it that as user clicks the Place button, i have to capture the value of commandArgument in a module level variable so that i can update it in Database.
Now as and when page displays and user clicks the Place button the page postback to server and then popup appears and at the same time i capture the value of commandargument of button in code behind. But, after the first click that is from 2nd time click of button displays the popup without sending the page on server. That is it’s not firing the onClick event of Place button and the value in module level variable remains unchanged. After that if user selects Ok button from popup it updates the value which sets in the module level variable when the Place button called at first.

What should i do?
Is there any mistake in my code?

<GridView id= "Grd" runat="server" AutoGenerateColumns="false" CssClass="GridStyle" 
           HeaderStyle-Font-Size="Small" Width="960" Visible="false">
          <Columns>          

          'Columns goes here          
          <asp:TemplateField HeaderText="Action" HeaderStyle-Width="310px" ItemStyle-HorizontalAlign="Left">
          <ItemTemplate>
              <asp:Button ID="btnDelete" runat="server" Text="Delete" OnClick="btnDelete_Click" 
              CommandArgument='<%#Eval("intHireEnquiryID") %>' />
              <asp:Button ID="btnPlace" runat="server" Text="Place" OnClick="btnPlace_Click"  
              CommandArgument='<%#Eval("intHireEnquiryID") %>' />
              <ajaxtk:ModalPopupExtender runat="server" ID="actPopup" TargetControlID="btnPlace" 
              PopupControlID="pnlPopup" CancelControlID="btnCancel" >
              </ajaxtk:ModalPopupExtender>
          </ItemTemplate>
          </asp:TemplateField>
          </Columns>          
          </GridView>          

InPanel i have two buttons PlaceFinal and Cancel which are used to Finally place and cancel the request.

In Code Behind i call it as : –

Dim popup As New AjaxControlToolkit.ModalPopupExtender
        Dim i As Integer
        For i = 0 To Grd.Rows.Count - 1
            popup = Grd.Rows(i).FindControl("actPopup")
            popup.Show()
        Next
        pnlPopup.Visible = True

Is there any attribute or anything else which i am missing so that the Place button onclick event not firing from second click onwards. Then why it’s working for first click?

The onclick event of button works only at first time and not after that.

  • 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-27T06:06:29+00:00Added an answer on May 27, 2026 at 6:06 am
    <GridView id= "Grd" runat="server" AutoGenerateColumns="false" CssClass="GridStyle"  
               HeaderStyle-Font-Size="Small" Width="960" Visible="false"> 
              <Columns>           
    
              'Columns goes here           
              <asp:TemplateField HeaderText="Action" HeaderStyle-Width="310px" ItemStyle-HorizontalAlign="Left"> 
              <ItemTemplate> 
                  <asp:Button ID="btnDelete" runat="server" Text="Delete" OnClick="btnDelete_Click"  
                  CommandArgument='<%#Eval("intHireEnquiryID") %>' /> 
                  <asp:Button ID="btnPlace" runat="server" Text="Place" OnClick="btnPlace_Click"   
                  CommandArgument='<%#Eval("intHireEnquiryID") %>' /> 
    
              </ItemTemplate> 
              </asp:TemplateField> 
              </Columns>           
              </GridView>         
    

    Remove the modalpopupextender which was taken inside gridview and keep it in an update panel like below and remember remove the TargetControlId of modalpopupextender from actual button to a dummy button which has no use on the page and hide it. This btnDummy is only to remove the bug of raising error when targetcontrolid is not defined for modalpopup and nothing.

    <asp:UpdatePanel ID="upPopupPnl" runat="server" UpdateMode="Conditional">
                <ContentTemplate>            
                <asp:Panel runat="server" ID="pnlPopup" Width="300px" Height="300px" BackColor="Azure" 
                style="overflow:auto;border-color:Black;border-style:solid;border-width:2px;">
                <table><tr><td colspan="2" style="width:300px;">
                <asp:RadioButtonList ID="rbl1" runat="server">
                </asp:RadioButtonList>          
                </td></tr>
                <tr><td style="text-align:center;">
                <asp:Button ID="btnPlacePopup" runat="server" Text="Place" Width="100" Height="35" Font-Bold="true" 
                OnClick="btnPlacePopup_Click" />
                </td>
                <td style="text-align:center;">
                <asp:Button ID="btnCancel" runat="server" Text="Cancel" Width="100" Height="35" Font-Bold="true" />
                </td></tr>
                </table>
                </asp:Panel>
                <asp:Button ID="btnDummy" runat="server" Text="Not Display" style="display:none;"/>
                <ajaxtk:ModalPopupExtender ID="actPopup1" runat="server" TargetControlID="btnDummy" BackgroundCssClass="modalBackground"  
                PopupControlID="pnlPopup" CancelControlID="btnCancel">
                </ajaxtk:ModalPopupExtender> 
                </ContentTemplate>
                </asp:UpdatePanel>
    

    The Css class is as: –

    .modalBackground 
    { 
      background-color:#B3B3CC; 
      opacity:0.5;
    }
    

    Code behind: –

    dim intHireEnquiryIDas integer 
    Protected Sub btnPlace_Click(ByVal sender As Object, ByVal e As System.EventArgs)
            intHireEnquiryID = CType(sender, Button).CommandArgument
            Dim EXP As New Exception
            Dim params(0) As SqlParameter
            params(0) = New SqlParameter("@intHireEnquiryID", intHireEnquiryID)
            Dim DS As New DataSet
            DS = execQuery("spAgent_Get_Assigned_Workers", executionType.SPExecuteForDS, EXP, params)
            If DS.Tables(0).Rows.Count > 0 Then
                rbl1.DataSource = DS
                rbl1.DataTextField = "WorkerDetail"
                rbl1.DataValueField = "intWorkerID"
                rbl1.DataBind()            
            End If
            upPopupPnl.Update()
            actPopup1.Show()
        End Sub
    

    Thus it works great and fine.
    Points to remember: –
    But remember to remove the TargetControlId of modalpopupextender from actual button to a dummy button which has no use on the page and hide it. And do not set visible property of panel which has to show to true or false. It will handle automatically by ajaxmodalpopupextender.
    Actually why i took a dummy button as targetcontrolid of modalpopup because i need to postback the page partially to update the generated list of radiobuttons. but if we take the main button as targetcontrolid then the default behaviour of button will be overridden by modalpopup extender and it will not postback the page. So, i took a dummy button. And on the actual button click event i generate the list and bind it to radiobuttonlist and then called the update method of update panel and then called the show method of modalpopup.
    It’s fine now….
    Thanks!!

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

Sidebar

Related Questions

I have to display Datetime in my gridview, the problem is that while I
I have Fancybox set up so that when a user clicks on a pdf
I'am building an asp.net application that have a gridview inside an update pannel. In
I have to display a login-pop-up window when the user clicks on the links
I have a user control that inside has a TextBlock (textmsg), the following is
When you set an html element to have display: none , the content inside
I have to display yes/no button on some condition on my asp.net page ,
I have to display a column chart in a user form in VBA. Exporting
I have some data that I have to display as a table. I think
Every now and then I receive a Word Document that I have to display

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.