Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Asp.net Ajax ModalPopupExtender DynamicMethod Never been Called

Avatar of YesOrKnow
YesOrKnow asked on
4 Comments1 Solution374 ViewsLast Modified:
Hi every expert,

My task is to add a ModalPopupExtender onto my asp.net page APage.aspx, and list a table of records with CheckBoxes and contents in the popup dialog. Users are able to select some interest rows, and after they click OK button, the selected data id values should be return back to its original page APage.aspx.

I have read the article from http://www.codeproject.com/KB/ajax/Dynamic_AJAX_Modal_Popup.aspx

Then I tried the following:

1. Register Ajax assembly in my APage.aspx:
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>

2. Add a button "btnSelectRows", and a panel "pnlRows"
<asp:Button ID="btnSelectRows" Text="Select Rows" runat="server" onclick="btnSelectRows_Click" />

<asp:Panel ID="pnlRows" runat="server" style="display:block;width:auto;" BackColor="White">
         <asp:Panel id="pnlHeader" runat="server">
             <p><h3><b>Please Choose the rows you would like to use:</b></h3></p>
         <table id="tblPopup">
              <thead class="popupheading">
                      <th style="width: auto; background: #6E9ECA; font-size: 10pt; color: white"><b>Selected</b></th>
                      <th style="width: auto; background: #6E9ECA; font-size: 10pt; color: white"><b>Note Type</b></th>
                      <th style="width: auto; background: #6E9ECA; font-size: 10pt; color: white"><b>Common Note</b></th>
                  <asp:Label ID="lblCommonNotes" runat="server"></asp:Label>
                    <td class="popupfooter">
                         <asp:Button ID="btnOK" runat="server" Text="OK" />
                         <asp:Button ID="btnCancel" runat="server" Text="Cancel" />

3. Add ModalPopupExtender:
<ajaxToolkit:ModalPopupExtender ID="mpeSelectRows" runat="server"
        PopupDragHandleControlID="pnlHeader" />

4. Add a web service methods:
    public string GetRows(string contextKey)
        StringBuilder _sb = new System.Text.StringBuilder();

        RowList rows = new RowList();
        foreach(Row r in RowList)
          _sb.Append("    <td align=\"right\">" + r.A + "</td>");
          _sb.Append("    <td align=\"center\">" + r.B + "</td>");
          _sb.Append("    <td align=\"center\">" + r.C + "</td>");

        return _sb.ToString();

5. In order to pass in the contextKey value, I added a click button event handler for the btnSelectRows called btnSelectRows_Click:
protected void btnSelectRows_Click(object sender, EventArgs e)
        if (ViewState["Parent Record"] != null)
            mpeSelectRows.DynamicContextKey = (RowType)ViewState["Parent Record"].Id.ToString();

After I run the project, I found the web method GetRows is never called, and I am not sure what's my problem.

Please help.
Avatar of YesOrKnow

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answers