Modal popup extender ? button of gridview1 click ?


i have panel1 and modal popup extender..and i have button1 on gridview1 as templatefield..

how can i use button1 as targetcontrolid of modalpopupextender ?


Mark as me if my question or my answer can be helpful for you :)
4/22/2009 5:56:41 PM 3977 articles. 0 followers. Follow

7 Replies

Similar Articles

[PageSpeed] 1
Get it on Google Play
Get it on Apple App Store


go to your ajax-toolkit.dll folder..drag the ajax-toolkit.dll file from there and drop on your toolbox of visual studio..

you can see all ajax tools in which tab you have droped it..

(please mark as an answer, if this helps you.)
4/23/2009 12:33:33 PM


i have panel1 and modal popup extender..and i have button1 on gridview1 as templatefield..

how can i use button1 as targetcontrolid of modalpopupextender ?


Mark as me if my question or my answer can be helpful for you :)
4/23/2009 3:24:26 PM


when my page.aspx load, i can see panel1 related to modalpopupextender then panel1 be closed..

But it should not be displayed when page.aspx load..

how can i fix it ?


Mark as me if my question or my answer can be helpful for you :)
4/27/2009 8:06:53 AM


We cannot set button that is in Gridview's template for modalpopupextender's TargetControlID directly because they are not in same name container.

In this case, you can try to show this modalpopup in codebehind class. For example:

<%@ Page Language="C#" %>

<%@ Import Namespace="System.Data" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<script runat="server">

    protected void Page_Load(object sender, EventArgs e)
        if (!IsPostBack)
            GridView1.DataSource = GetDT();

    public DataTable GetDT()
        DataTable dt = new DataTable();
        dt.Columns.Add("name", typeof(String));
        dt.Columns.Add("detail", typeof(String));

        DataRow dr = dt.NewRow();
        dr[0] = "James";
        dr[1] = "James is my director!";

        DataRow dr1 = dt.NewRow();
        dr1[0] = "Thomas";
        dr1[1] = "Thomas is engineer!";

        DataRow dr2 = dt.NewRow();
        dr2[0] = "Vince";
        dr2[1] = "Vince is engineer too!!";

        return dt;

    protected void Button1_Click(object sender, EventArgs e)


<html xmlns="">
<head runat="server">
    <style type="text/css">
    .modalBackground {

.modalPopup {
    <form id="form1" runat="server">
        <asp:ScriptManager ID="sm" runat="server">
            <asp:gridview ID="GridView1" runat="server" >
                    <asp:templatefield HeaderText="Buton">
                            <asp:button ID="Button1" runat="server" OnClick="Button1_Click" Text="ShowModulPopup" />
            <asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" Style="display: none"
                Show Modal Popup!
                <asp:Button ID="OkButton" runat="server" Text="OK" />
                <asp:Button ID="CancelButton" runat="server" Text="Cancel" />
            <asp:button ID="Button3" runat="server" Text="Button" Style="display: none" />
            <ajaxtoolkit:modalpopupextender ID="ModalPopupExtender1" runat="server" TargetControlID="Button3"
                PopupControlID="Panel1" BackgroundCssClass="modalBackground" OkControlID="OkButton"



I look forward to receiving your test results.

Thomas Sun
Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
4/28/2009 5:22:36 AM


i have added Style="display: none" for panel1 so my panel1 dont display when page load.. when i click button1, my panel1 be displayed..

<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" Style="display: none"

But when i click button1, page load again then my panel1 be displayed.. is there a way that without loading page for displaying panel1 ?

I have tried updatepanel for this(I put panel1 and button1 in updatepanel).. but my panel1 have been displayed below gridview1.. not center of page.aspx.. also CssClass doesnt be displayed..


Mark as me if my question or my answer can be helpful for you :)
4/28/2009 6:49:58 AM


try putting target control and OK button outside the update panel..

start update panel inside the asp:panel and complete it before ok button..this is how i have done before and it works fine.

hope this helps you..

(please mark as an answer, if this helps you.)
4/28/2009 3:14:58 PM

Similar Artilces:

Visual Web Dev 2005 Express & SQL 2005 Express
Last week I downloaded and installed Vis Web Dev Express 2005 and have it running absolutely fine.  2 days later I downloaded the most recent SQL Server Express but when I try to install it, I get a message saying it has "detected incompatible beta components fromVisual Studio or SQL Server" and that I must "run the build clean up wizard from the cd."  Since I downloaded both parts I dont have a cd.  I dont particularly want to uninstall webdev express because the download was so slow the first time and it doesn't leave an install file for reinstallation.  What's my best ...

Image button if fired, but there is a new issue. Help needed in displaying mutiple data in accordian style(using modal popup extender) when grid row is selected and image button is clicked
Hi, I did work on server side code of image button without specfiying Modal Pop up target control id as imagebutton in aspx page, it throws error when registering the imagebutton in Grid selected Index changed event.. here is code vwbenftsBtn.Click += new EventHandler(this.vwbenftsBtn_Click); I am not sure why is it throwing error... Using the button instead of image button works fine.. we have a Masterpage with all the web application menus and other copyright stuff added and this page is referenced in all the pages. The issue is we have form tag defined in the Masterpage. For the mo...

get submit button click of modal popup extender
Dear AllI have the following setup to create a modal popup :-                              <!-- Modal Window for Product -->                            <asp:Panel ID="pnlProduct" runat="server" Style="display: none" >          &nbs...

Modal popup extender inside another modal popup extender
Hi all,  I would like to know if this is possible. Lets say a have a page with modalpopup extender and with update panel. Onto that modal popup extender I dynamically and with async postback load a UserControlA. That UserControlA also contains modal popup extender and updatepanel, which loads UserControlBdynamically (sort of  modal popup inheritance:) ) Is this at least possible in theory? To show another modalpopup in the first modalpopup? Because right now, trigerring modalpopup in UserControlA, modalpopup in page closes  UI would be something like this: The problem...

Web Matrix vs Vis Web Dev 2005 Express
Hi - i'm looking to upsize MS Access DBs to SQL Server and also migrate to web vs LAN- Yesterday downloaded SQL Server 2005 express and Vis web Debveloper Express as learning tools (haven't yet installed) Today ran across Web Matrix - which appears to be for earlier versions of .Net Are Matrix and Web Developer express similar? Can someone fill me in - which should i be learning? thanks  Just to make sure you're clear, Web Matrix is for ASP.NET 1.1 and VWD is for ASP.NET 2.0.While Web Matrix met a need, Visual Web Developer is by far the superior tool.  If you have the op...

move database from web dev express to SQL 2005 or SQL Express
I'm guessing something like this has been posted before, but I'm having trouble finding excatly what I'm looking for.  Here's the situation. I am building a site based on the club starter kit.  The database appears to be part of the web project.  I've modified some of the tables so it's not the original club database anymore. I would like to move this database to SQL Express (i.e. the database will appear in my SQL Server Mgmt. Studio) and I would also like to try to move it to SQL 2005.  I don't have a host yet, so I think being able to move it to either product would ...

VS.NET 2005 & Visual Web Developer 2005 Express
I'm currently working on VWD using C#, and i'm planning to study MCTS, so i'm wondering if there's major differences between both in Web field.Thank you aloti need a creative atmosphere Not for what you're doing.JeffPlease: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue....

Visual Web Developer Express 2005 and Visual Studio .Net 2005
I have Visual Studio .NET installed and have purchased a textbook for learning that uses examples, cases, and projects which reference use of Visual Web Developer Express 2005 (VWD). I have discovered that there are some nuances of differences between the Web UI in Visual Studio .Net 2005 and VWD. Therefore, I want to install VWD. I downloaded VWD and started to install it but stopped as I noticed the intallation as about to copy all it's files into the same directory the contained Visual Studio. I'm scared I'm going to screw up my Visual Studio installation, so I thought I&...

ajax modal popup,confirm button extenders are applying for one button but not applying for other buuton
hi, iam using 2 image  buutons based on the condition that buttons are displayed i'e when iam login as a ordinary user iam  displying "add to cart" image button in this case ajax modal poopup and confirm button extenders are working.but when the user login as a whole saler iam displaying the "add to order" image button in this case ajax model popup and confirm button extenders are not working and displaying the panel content before clicking only. iam bringing 2 confirm button extenders and 2 model popup extenders but iam using one panel(i'e sam...

Visual Web Dev Express 2008 and SQL server Express 2005 database connection problem
Apologies if this has already been covered, i can't find any search function on the forum. I have a somewhat annoying problem with the above software. I use Vista Home Premium x64 and have decided to install VWD 2008 and SQL2005 to learn ASP and SQL development. I only have a moderate undertanding of standard HTML and would like to expand my knowledge.  It is the final non-beta version of VWD 2008. The install went fine and no errors were shown. After trying to connect to the database via the ASP.NET application tool in VWD it gives an "unable to connect to the database ...

How to Create a Simple Web Form for Go Daddy hosted site from Visual Web Dev 2005 Express Edition
I have spent all weekend trying to make my simple form mail WORK.  And now, much forum hunting and Go Daddy calling later, I want to post what I have learned, hoping to save another newbie a loooooong weekend.  So here goes:1) If you don't have one already, create an e-mail account at Go Daddy.  It will take about 15 minutes to become active.  Write down your user id and password, then forge ahead with the rest of this.  It will take you less than an hour, depending on how detailed your form is.2) Create your form in MS VWD 2005 X ed using the Wizard tool...

Modal Popup closing after button is clicked
Hello guys, I have the below script dealing with an ajax modal popup: ==========================================================================================<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MyModalPopup.aspx.cs" Inherits="WebApplication2.MyModalPopup" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""><html xmlns="" > <head id="Head1" runat="server&q...

Modal Popup closing on any button click
Is there anyway possible to keep a modal popup open through clicking a button?If a user were to try to join a certain group that is a "private group" I would like to prompt them for a password through the modal popup.  Whenever a user clicks any button though, the box closes immediately.  I have tried nesting update panels inside the modal popup panel and that hasn't worked yet.  Any suggestions?  Thanks,  ChrisWeb In base page check the condition wheather user is signed in or not. If not signed in register  cli...

Modal Popup Extender Button Action
Hi, I am using AJAX Modal Popup to build a disclaimer for one of our web pages, I finished this step and it works fine. Then I want if user clicks Ok button, they will get to download an Excel file, and at the same time, the modal popup should disappear. I tried first by using Javascript, the strange thing is it keeps giving me Object Expected error? I tried register the Javascript block in Load method, tried include the outer Javascript file, it all did not work. Then I began to try to use button click, that let me offer the window for file Open or Save, but how do I do it grace...

Web resources about - Modal popup extender ? button of gridview1 click ? -

City of North Miami
SEARCH Contact Us - Employment - Español - Kreyol 305.893.6511 - 776 NE 125 Street - North Miami, FL 33161 EMERGENCY SERVICES HOME DEPARTMENTS ...

Check Uncheck all CheckBoxes in an ASP.NET GridView using jQuery
... void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Employee emp = new Employee(); listEmp = emp.GetEmployees(); this.GridView1.DataSource ...

TEA Staff Search
Administrators school resources Teachers teacher resources Funding school finance & grants Testing / Accountability student assessment & ...

TEA Staff Search
Administrators school resources Teachers teacher resources Funding school finance & grants Testing / Accountability student assessment & ...

Resources last updated: 1/6/2016 8:38:58 PM