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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:57:05+00:00 2026-05-26T04:57:05+00:00

I cannnot get the ModalPopupExtender to work via code. If I set the ModalPopupExtender’s

  • 0

I cannnot get the ModalPopupExtender to work via code. If I set the ModalPopupExtender’s property TargetControlID=”btn”, it works. When I set TargetControlID=”HiddenField1″ to use the mpe.show() method in the code, it does not work (the dgvResults_RowCommand event fires fine, I have tested it). I have gone through many sites looking at code, and cannot figure out whats wrong. Thanks in advance for any help

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="Michlala._Default" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    <style type="text/css">
        .modalPopup 
        {               
            background-color: Black;
            filter: alpha(opacity=80);
            opacity: 0.8;
            z-index: 10000;             
        }
        .style1
        {
            width: 100%;
        }
        .style5
        {
            text-align: center;
        }
    </style>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h1> Student Feedback</h1>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>       
    <br />
    <asp:TextBox ID="txtSID" runat="server" Width="61px" Height="25px"></asp:TextBox>  
    &nbsp;&nbsp;&nbsp;&nbsp;  
    <asp:Button ID="btnSID" runat="server" onclick="Button1_Click" 
        Text="Submit Student ID" />

    <asp:GridView ID="dgvResults" runat="server" Visible="False" 
        onrowcommand="dgvResults_RowCommand">
        <Columns>
            <asp:TemplateField>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>                        
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Button ID="btnFeedback" runat="server" onclick="Button1_Click1" 
                        Text="Add FeedBack" CommandName="InsertFeedback" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"  />
                       <asp:HiddenField ID="HiddenField1" runat="server" />
                    <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" 
                         TargetControlID="HiddenField1"
                         PopupControlID="pnlModalPanel"
                         CancelControlID="btnCancel"
                         BackgroundCssClass="modalPopup" > 
                    </asp:ModalPopupExtender>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <asp:Panel ID="pnlModalPanel" runat="server"  style="display:none" Width="481px" >
        <table class="style1">
            <tr>
                <td>
                    Course
                </td>
                <td>
                    Semester
                </td>
                <td class="style5">
                    Teacher Assitant
                </td>
                <td class="style5">
                    Lecturer
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp
                    <asp:TextBox ID="txtCourse" runat="server"></asp:TextBox>
                </td>
                <td>
                    &nbsp
                </td>
                <td>
                    &nbsp
                </td>
                <td>
                    &nbsp
                </td>
            </tr>
            <tr>
                <td colspan="2" style="text-align: center">
                    <asp:Button ID="btnSubmit" runat="server" Text="Submit" />
                    &nbsp;
                </td>
                <td colspan="2">
                    &nbsp
                    <asp:Button ID="btnCancel" runat="server" Text="Cancel" />
                </td>
            </tr>
        </table>    
    </asp:Panel>
    <asp:DropDownList ID="ddlSemester" runat="server">
    </asp:DropDownList>
    <asp:Label ID="lblRes" runat="server" Text="Label"></asp:Label>        
    <br />        
</asp:Content>

in the server side code

protected void dgvResults_RowCommand(object sender, GridViewCommandEventArgs e)
{
    ModalPopupExtender mpe = new ModalPopupExtender();
    mpe.Show();
}
  • 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-26T04:57:06+00:00Added an answer on May 26, 2026 at 4:57 am

    You need to fin the ModalPopupExtender in the selected row and then call it with the name:

    if (e.CommandName.Equals("InsertFeedback"))
    {
        int index = Convert.ToInt32(e.CommandArgument);
    
        // Retrieve the row that contains the button clicked 
        // by the user from the Rows collection.
        GridViewRow row = dgvResults.Rows[index];
    
        ModalPopupExtender mpe = (ModalPopupExtender)row.FindControl("ModalPopupExtender1");
        mpe.Show();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I cannot get the following code to work. #include <stdio.h> // I am not
I cannot get this modal dialog to work property. Problem is that in a
I cannot get understanding code to work? I dont know why? Is it even
I cannot get this to work. I want to use str_to_date to convert a
I cannot get a two-way bind in WPF to work. I have a string
I cannot get the internet explorer web developer tool bar to work with a
I cannot get Bindable LINQ to work with VB.NET for the life of me.
I cannot get the jQuery slideDown function to work on <table> elements. They just
I cannot get the DropDownHeight of the ComboBox set properly to display all the
I cannot get the like statement to work with space and trailing wildcard. My

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.