Question

ModalPopupExtender inside GridView not working?

Asked by: Muralidharanp

i am using a ModalPopupExtender inside a gridview.
       my requirement is when i clicks a linkbutton(linkFlagsNew) in the gridview it should display "ModalPopupFR", which contains the user login or registration processes. when i clicks login button in "ModalPopupFR" (after entering the user credentials ), it should displays the "ModalPopupFM", Which will send a mail. The inner functionality like check login, registering user, sending mail all are working fine. but am having problem with visibility of the ModalPopup's.

i have lot of problems with that ModalPopup. The below are the list of my Problems.
         1. When i click the first row of the gridview it will shows the "ModalPopupFR" correctly, but when i try for the second row or other rows of the gridview it doesnt shows the "ModalPopupFR".
         2. When ever the page gets PostBack, it closes all my opened modalpopup's.
         3. I cant Show or Hide the ModalPopup's on my Code Behind Page.


My CodeBehind Page:

protected void linkFlagsNew_Click(object sender, EventArgs e)
        {
            int i = Convert.ToInt32(((LinkButton)sender).CommandArgument.ToString());

            ((AjaxControlToolkit.ModalPopupExtender)gvNewest.Rows[i].FindControl("ModalPopupFR")).Show();

        }

        //Newest Flag Register
        protected void FROkButton_Click(object sender, EventArgs e)
        {
            int i = Convert.ToInt32(((Button)sender).CommandArgument.ToString());

            FREnableValidator(i,gvNewest);

            ((AjaxControlToolkit.ModalPopupExtender)gvNewest.Rows[i].FindControl("ModalPopupFR")).Page.Validate("c");

            if (((AjaxControlToolkit.ModalPopupExtender)gvNewest.Rows[i].FindControl("ModalPopupFR")).Page.IsValid)
            {

                UserEntity user = new UserEntity();
                user.DisplayName = ((TextBox)gvNewest.Rows[i].FindControl("FRtxtUser")).Text;
                user.Password = ((TextBox)gvNewest.Rows[i].FindControl("FRtxtPass")).Text;
                user.EmailID = ((TextBox)gvNewest.Rows[i].FindControl("FRtxtEmail")).Text;
                user.Age = Convert.ToInt32(((TextBox)gvNewest.Rows[i].FindControl("FRtxtAge")).Text);
                user.JoinDate = DateTime.Now;

                UserProfileEntity prof = new UserProfileEntity();
                prof.EmailID = ((TextBox)gvNewest.Rows[i].FindControl("FRtxtEmail")).Text;
                prof.FirstName = ((TextBox)gvNewest.Rows[i].FindControl("FRtxtFirst")).Text;
                prof.LastName = ((TextBox)gvNewest.Rows[i].FindControl("FRtxtSecond")).Text;

                UserBO uObj = new UserBO();
                uObj.AddtoUsers(user);

                UserProfileBO pObj = new UserProfileBO();
                pObj.AddtoUserProfiles(prof);

                Session["FlagUser"] = user.EmailID;

                ((AjaxControlToolkit.ModalPopupExtender)gvNewest.Rows[i].FindControl("ModalPopupFR")).Hide();
                FRDisableValidator(i,gvNewest);

                ((AjaxControlToolkit.ModalPopupExtender)gvNewest.Rows[i].FindControl("ModalPopupFM")).Show();

            }
            else
            {
                ((AjaxControlToolkit.ModalPopupExtender)gvNewest.Rows[i].FindControl("ModalPopupFR")).Show();
            }
        }

        //Newest Flag Login
        protected void FRlog_Click(object sender, EventArgs e)
        {
            int i = Convert.ToInt32(((Button)sender).CommandArgument.ToString());

            string username = ((TextBox)gvNewest.Rows[i].FindControl("FRusername")).Text;
            string pass = ((TextBox)gvNewest.Rows[i].FindControl("FRpass")).Text; ;

            if ((!username.Equals(String.Empty)) || (!pass.Equals(String.Empty)))
            {
                UserBO uObj = new UserBO();
                IList<UserEntity> dsUser = uObj.CheckUser(username, pass);
                if (dsUser.Count > 0)
                {
                    Session["FlagUser"] = dsUser[0].EmailID.ToString();
                    ((AjaxControlToolkit.ModalPopupExtender)gvNewest.Rows[i].FindControl("ModalPopupFR")).Show();
                }
                else
                {
                    ((AjaxControlToolkit.ModalPopupExtender)gvNewest.Rows[i].FindControl("ModalPopupFM")).Hide();
                }
            }
            else
            {
                ((AjaxControlToolkit.ModalPopupExtender)gvNewest.Rows[i].FindControl("ModalPopupFM")).Hide();
            }

        }

        //Newest Flag Send Mail
        protected void FMOkButton_Click(object sender, EventArgs e)
        {
            int i = Convert.ToInt32(((Button)sender).CommandArgument.ToString());
            ((Label)gvNewest.Rows[i].FindControl("lblerror")).Text = "";

            string option = (((RadioButtonList)gvNewest.Rows[i].FindControl("rdOption")).SelectedItem.Text);

            SendMail mObj = new SendMail();
            if (mObj.MailtoSend(Session["FlagUser"].ToString(), "muralidharanp@cybonyx.com", "Flag : " + option, option))
            {
                ((AjaxControlToolkit.ModalPopupExtender)gvNewest.Rows[i].FindControl("ModalPopupFM")).Hide();
                ((AjaxControlToolkit.ModalPopupExtender)gvNewest.Rows[i].FindControl("ModalPopupFR")).Hide();

            }
            else
            {
                ((AjaxControlToolkit.ModalPopupExtender)gvNewest.Rows[i].FindControl("ModalPopupFM")).Show();
                ((AjaxControlToolkit.ModalPopupExtender)gvNewest.Rows[i].FindControl("ModalPopupFR")).Show();
                ((Label)gvNewest.Rows[i].FindControl("lblerror")).Text = "Problem in Mail Sending";

            }
        }

       private void FREnableValidator(int i, GridView gv)
        {
            ((RequiredFieldValidator)gv.Rows[i].FindControl("FRrequsername")).Enabled = true;
            ((RequiredFieldValidator)gv.Rows[i].FindControl("FRreqpassword")).Enabled = true;
            ((CompareValidator)gv.Rows[i].FindControl("FRcpassword")).Enabled = true;
            ((RequiredFieldValidator)gv.Rows[i].FindControl("FRreqemail")).Enabled = true;
            ((RegularExpressionValidator)gv.Rows[i].FindControl("FRregemail")).Enabled = true;
            ((RequiredFieldValidator)gv.Rows[i].FindControl("FRreqname")).Enabled = true;
            ((ValidationSummary)gv.Rows[i].FindControl("FRsumm")).Enabled = true;

        }
        private void FRDisableValidator(int i, GridView gv)
        {
            ((RequiredFieldValidator)gv.Rows[i].FindControl("FRrequsername")).Enabled = false;
            ((RequiredFieldValidator)gv.Rows[i].FindControl("FRreqpassword")).Enabled = false;
            ((CompareValidator)gv.Rows[i].FindControl("FRcpassword")).Enabled = false;
            ((RequiredFieldValidator)gv.Rows[i].FindControl("FRreqemail")).Enabled = false;
            ((RegularExpressionValidator)gv.Rows[i].FindControl("FRregemail")).Enabled = false;
            ((RequiredFieldValidator)gv.Rows[i].FindControl("FRreqname")).Enabled = false;
            ((ValidationSummary)gv.Rows[i].FindControl("FRsumm")).Enabled = false;

        }

My Question.aspx Page:
 
 <asp:GridView ID="gvNewest" Width="100%" runat="server" GridLines="None" AutoGenerateColumns="false"
        ShowHeader="false" DataKeyNames="QuestionID" OnRowDataBound="gvNewest_RowDataBound"
        AllowPaging="true">
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                <span>
                    <div class="answer">
                        <strong>
                            <asp:Label ID="lblCntNew" runat="server"></asp:Label></strong><br />
                        Answers
                    </div>
                    <ul class="review-Beams1 left">
                        <li class="Beams-count1"><a href="#">
                            <asp:Label ID="lblBeamNew" runat="server"></asp:Label><span><br />
                                                                        beams</span> </a></li>
                        <li class="Beams-it1">
                            <asp:LinkButton ID="lnkBeam" Enabled="false" runat="server" Text="Beam"></asp:LinkButton><br>
                            Up</li>
                        <li><a href="#">What is this?</a></li>
                    </ul>
                    <div class="review-body">
                        <h4>
                            <a href="#">
                                <asp:LinkButton ID="LinkButton1" runat="server" Text=' <%# Eval("QuestionTitle") %> ' />,</a></h4>
                        Written
                        <asp:Label ID="Label1" runat="server" Text=' <%# Eval("QuestionDate","{0:MM/dd/yyyy}")%> '></asp:Label>
                        <p>
                            <%# Eval("QuestionText") %></p>
                        <p>
                            <a href="#">Read More </a>
                        </p>
                        <div class="review-details">
                            <asp:LinkButton ID="LinkButton2" CssClass="tool flag" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
                                OnClick="linkFlagsNew_Click" runat="server" Text="Flags" />
                            <asp:HiddenField ID="HiddenField1" runat="server" />
                            <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" BehaviorID="FRModal" runat="server"
                                CancelControlID="FRCancel" TargetControlID="linkFlagsNew" PopupControlID="FRPannel"
                                RepositionMode="None" BackgroundCssClass="modalBackground" DropShadow="true" />
                            <!-- Modal PopUpExtender -->
                            <asp:Panel ID="Panel1" runat="server" Style="display: none" CssClass="modalPopup"
                                Width="560px">
                                <table width="560px" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td colspan="3">
                                            <asp:Label ID="Label2" runat="server" Visible="false" Text=' <%# Eval("QuestionID") %> '></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="3">
                                            <b>You've got to login or join to Flag that!</b>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="3">
                                            <hr />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="3">
                                            Login, if you are already a Flag user!
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                        </td>
                                        <td align="right">
                                            User
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                        </td>
                                        <td align="right">
                                            Password
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                        </td>
                                        <td colspan="2" align="center">
                                            <asp:Button ID="Button1" Text="Flag" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
                                                CausesValidation="false" runat="server" OnClick="FRlog_Click"></asp:Button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="3">
                                            <hr />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="15%">
                                            <b>Join to Flag</b>
                                        </td>
                                        <td colspan="2">
                                            <p>
                                                Flag is to share the comments of the web. Start Flagging and Commenting by creating
                                                an account  it only takes a minute.</p>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                        </td>
                                        <td align="right" valign="top" colspan="1">
                                            Choose a username (no spaces)
                                        </td>
                                        <td align="left" valign="top" colspan="1">
                                            <asp:TextBox ID="TextBox3" runat="server" Text="" ValidationGroup="c"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" Enabled="false" runat="server"
                                                Text="*" ValidationGroup="c" ErrorMessage="Please enter UserName" ControlToValidate="FRtxtUser"></asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                        </td>
                                        <td align="right" valign="top" colspan="1">
                                            Choose a password
                                        </td>
                                        <td align="left" valign="top" colspan="1">
                                            <asp:TextBox ID="TextBox4" runat="server" ValidationGroup="c" TextMode="Password"
                                                Text=""></asp:TextBox>
                                            <div class="registervalidator">
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" Enabled="false" runat="server"
                                                    ValidationGroup="c" Text="*" ErrorMessage="Please enter password" ControlToValidate="FRtxtPass"></asp:RequiredFieldValidator></div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                        </td>
                                        <td align="right" valign="top" colspan="1" height="10px">
                                            Retype password
                                        </td>
                                        <td align="left" valign="top" colspan="1">
                                            <asp:TextBox ID="TextBox5" ValidationGroup="c" runat="server" TextMode="Password"
                                                Text=""></asp:TextBox>
                                            <div class="registervalidator">
                                                <asp:CompareValidator ID="CompareValidator1" Enabled="false" ValidationGroup="c"
                                                    runat="server" Text="*" ErrorMessage="Please Re-type the password correctly."
                                                    ControlToValidate="FRtxtRePass" ControlToCompare="FRtxtPass"></asp:CompareValidator>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                        </td>
                                        <td align="right" valign="top" colspan="1">
                                            Email address (must be real!)
                                        </td>
                                        <td align="left" valign="top" colspan="1">
                                            <asp:TextBox ID="TextBox6" runat="server" Text="" ValidationGroup="c"></asp:TextBox>
                                            <br />
                                            <asp:CheckBox ID="CheckBox1" runat="server" Checked="true" Text="  Send me occasional Digg updates.  " />
                                            <div class="registervalidator">
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" Enabled="false" ValidationGroup="c"
                                                    runat="server" Text="*" ErrorMessage="Please enter Email Address." ControlToValidate="FRtxtEmail"
                                                    Display="Dynamic"></asp:RequiredFieldValidator>
                                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" ValidationGroup="c"
                                                    Enabled="false" Display="Dynamic" runat="server" Text="Please enter a valid Email."
                                                    ControlToValidate="FRtxtEmail" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                        </td>
                                        <td align="left" valign="top" colspan="1">
                                            FirstName
                                            <asp:TextBox ID="TextBox7" runat="server" ValidationGroup="c" Text=""></asp:TextBox>
                                            <div class="registervalidator">
                                                <asp:RequiredFieldValidator ValidationGroup="c" Enabled="false" ID="RequiredFieldValidator4"
                                                    runat="server" Text="*" ErrorMessage="Please enter FirstName." ControlToValidate="FRtxtFirst"></asp:RequiredFieldValidator>
                                            </div>
                                        </td>
                                        <td align="left" valign="top" colspan="1">
                                            LastName &nbsp;
                                            <asp:TextBox ID="TextBox8" runat="server" Text=""></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                        </td>
                                        <td align="right" colspan="1">
                                            Age
                                        </td>
                                        <td align="left" colspan="1">
                                            <asp:TextBox ID="TextBox9" runat="server" Text=""></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                        </td>
                                        <td valign="top" align="center" colspan="2">
                                            <asp:ValidationSummary ID="ValidationSummary1" Enabled="false" runat="server" ValidationGroup="c"
                                                DisplayMode="SingleParagraph" ShowSummary="true" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                        </td>
                                        <td align="left" colspan="2">
                                            I agree to the Terms of Use and Privacy Policy &nbsp;
                                            <asp:Button ID="Button2" runat="server" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
                                                Text="I agree, continue.." OnClick="FROkButton_Click" CausesValidation="false" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="3">
                                            <asp:LinkButton ID="LinkButton3" runat="server" Text="X Close" CausesValidation="false"></asp:LinkButton>
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                            <!-- Modal PopUpExtender -->
                            <asp:HiddenField ID="HiddenField2" runat="server" />
                            <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender2" runat="server" BehaviorID="FMModal"
                                CancelControlID="FMCancel" TargetControlID="hdnFMModal" PopupControlID="FMPannel"
                                RepositionMode="None" BackgroundCssClass="modalBackground" DropShadow="true" />
                            <!-- Modal PopUpExtender -->
                            <asp:Panel ID="Panel2" runat="server" Style="display: none" CssClass="modalPopup"
                                Width="300px">
                                <table width="300px" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td colspan="2">
                                            <asp:Label ID="Label3" runat="server" Visible="false" Text=' <%# Eval("QuestionID") %> '></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            Choose :
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="15%">
                                        </td>
                                        <td>
                                            <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Vertical">
                                                <asp:ListItem Value="bad">Bad Words</asp:ListItem>
                                                <asp:ListItem Value="vulgure">Vulgure</asp:ListItem>
                                            </asp:RadioButtonList>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                        </td>
                                        <td align="left" colspan="1">
                                            <asp:Button ID="Button3" runat="server" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
                                                Text="Send Mail" OnClick="FMOkButtonPop_Click" CausesValidation="false" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="3">
                                            <asp:LinkButton ID="LinkButton4" runat="server" Text="X Close" CausesValidation="false"></asp:LinkButton>
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                            <!-- Modal PopUpExtender -->
                            <asp:LinkButton ID="LinkButton5" CssClass="tool comments" runat="server" Text="Comments" />
                        </div>
                    </div>
                    <div class="dividerBorder">
                    </div>
                </span>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-08-10 at 04:35:20ID24639573
Topics

C# Programming Language

,

Programming for ASP.NET

,

Asynchronous Javascript and XML (AJAX)

Participating Experts
1
Points
0
Comments
12

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Binding inner gridview
    I am binding the inner gridview in the onrowdatabound of outer grid but i am not able do paging for the inner gridview which loads in the outer gridview rowdatabound method.
  2. UserControl inside a GridView ItemTemplate
    I have a usercontrol called A1.ascx. In this, I have a gridview. Then there is another usercontrol called A2.ascx. I want this usercontrol to show inside a gridview ItemTemplate. The A2.ascx has some methods like Initialize and Save instantiated by using public override void....
  3. GridView
    Hey, I am trying to bind a Gridview to a table from SQL 2005 Database. It works fine at first, but the GridviEw doesnt show any values(columns) from the Database Table at all. It shows only the edit and Delete Button but No Information!! What can the problem be? How do i reso...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: TheLearnedOnePosted on 2009-08-10 at 17:25:39ID: 25065351

There are reasons for the ModalPopupExtender not to work, but it is difficult to know just the right one...

1) Dynamic controls not recreated after post-back.

2) Dynamic controls not created at the correct time in the page life-cycle.

3) Incorrect control IDs.

 

by: MuralidharanpPosted on 2009-08-10 at 22:09:29ID: 25066270

Hi TheLearnedOne,

Thanks for your reply.
I think, am not creating any dynamic controls on my code behind page. my ModalPopup's are just inside the ItemTemplate of the GridView.
1. when i clicks the first row of my grid, it shows the ModalPopupFR but when i clicks the second row of my grid it doesn't show the ModalPopupFR....
2. The ValidationSummary control shows error messages (repeatedly the same set of messages) - three times for a single button click on the ModalPopup.... (is it get validates three times for a single click?)...
3. ModalPopupFR.Show() or ModalPopupFR.Hide() doesn't works in CodeBehind aspx.cs page.

Please help me to rectify these Problems.....

 

by: TheLearnedOnePosted on 2009-08-11 at 06:31:54ID: 25068792

I am not a big fan of abbreviations, since they are not as self-explanatory (see Extreme Programming concepts).

What is the difference between ModalPopupFR and ModalPopupFM?  What are the popup extenders actually "popping up"?

 

by: MuralidharanpPosted on 2009-08-11 at 23:49:14ID: 25076209

Sorry for the inconvenience...
These are just the ID of my modalpopups
(ModalPopupFR - Modalpopup for Flag Registration and login)
(ModalPopupFM - Modalpopup for Flag sending Mail).
you can see that in the aspx page above on code snippet..

Please help me.

 

by: TheLearnedOnePosted on 2009-08-12 at 08:49:21ID: 25079906

1) I would love to help, but I am not a big fan of looking through all that code to find a needle in a haystack.

2) Is the popup control a Panel, <div>, etc.?

3) Can you show me just the relevant bits of code/HTML that might explain, rather than all of it?

 

by: MuralidharanpPosted on 2009-08-12 at 22:23:42ID: 25085602

hi TheLearnedOne

yes the popup control is a panel.

<asp:LinkButton ID="LinkButton2" CssClass="tool flag" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
            OnClick="linkFlagsNew_Click" runat="server" Text="Flags" />
            
        <asp:HiddenField ID="HiddenField1" runat="server" />
        <ajaxtoolkit:modalpopupextender id="ModalPopupExtender1" behaviorid="FRModal" runat="server"
            cancelcontrolid="FRCancel" targetcontrolid="linkFlagsNew" popupcontrolid="FRPannel"
            repositionmode="None" backgroundcssclass="modalBackground" dropshadow="true" />
        <!-- Modal PopUpExtender 1 -->
        <asp:Panel ID="Panel1" runat="server" Style="display: none" CssClass="modalPopup"
            Width="560px">
            <asp:Label ID="Label2" runat="server" Visible="false" Text=' <%# Eval("QuestionID") %> '></asp:Label>
            Login, if you are already a Flag user!
            <br />
            User:
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <br />
            Password:
            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
            <asp:Button ID="Button1" Text="Flag" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
                CausesValidation="false" runat="server" OnClick="FRlog_Click"></asp:Button>
            <br />
            <b>Join to Flag</b>
            <br />
            Choose a username (no spaces):
            <asp:TextBox ID="TextBox3" runat="server" Text="" ValidationGroup="c"></asp:TextBox>
            <br />
            Choose a password:
            <asp:TextBox ID="TextBox4" runat="server" ValidationGroup="c" TextMode="Password"></asp:TextBox>
            <br />
            Email address (must be real!):
            <asp:TextBox ID="TextBox6" runat="server" Text="" ValidationGroup="c"></asp:TextBox>
            <br />
            I agree to the Terms of Use and Privacy Policy &nbsp;
            <asp:Button ID="Button2" runat="server" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
                Text="I agree, continue.." OnClick="FROkButton_Click" CausesValidation="false" />
            <br />
            <asp:LinkButton ID="LinkButton3" runat="server" Text="X Close" CausesValidation="false"></asp:LinkButton>
        </asp:Panel>
        <!-- Modal PopUpExtender -->
        
        <asp:HiddenField ID="hdnFMModal" runat="server" />
        <ajaxtoolkit:modalpopupextender id="ModalPopupExtender2" runat="server" behaviorid="FMModal"
            cancelcontrolid="FMCancel" targetcontrolid="hdnFMModal" popupcontrolid="FMPannel"
            repositionmode="None" backgroundcssclass="modalBackground" dropshadow="true" />
        <!-- Modal PopUpExtender 2 -->
        <asp:Panel ID="Panel2" runat="server" Style="display: none" CssClass="modalPopup"
            Width="300px">
            <asp:Label ID="Label3" runat="server" Visible="false" Text=' <%# Eval("QuestionID") %> '></asp:Label>
            Choose :
            <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Vertical">
                <asp:ListItem Value="bad">Bad Words</asp:ListItem>
                <asp:ListItem Value="vulgure">Vulgure</asp:ListItem>
            </asp:RadioButtonList>
            <br />
            <asp:Button ID="Button3" runat="server" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
                Text="Send Mail" OnClick="FMOkButtonPop_Click" CausesValidation="false" />
            <br />
            <asp:LinkButton ID="LinkButton4" runat="server" Text="X Close" CausesValidation="false"></asp:LinkButton>
        </asp:Panel>
        <!-- Modal PopUpExtender -->

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:

Select allOpen in new window

 

by: TheLearnedOnePosted on 2009-08-13 at 06:58:10ID: 25088250

Here is what I see:

1) A LinkButton that might have been named "linkFlagsNew", but is now "LinkButton2".

<asp:LinkButton ID="LinkButton2" CssClass="tool flag" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
            OnClick="linkFlagsNew_Click" runat="server" Text="Flags" />

2) A ModalPopupExtender that refers to TargetControlID = "linkFlagsNew".
           
        <asp:HiddenField ID="HiddenField1" runat="server" />
        <ajaxtoolkit:modalpopupextender id="ModalPopupExtender1" behaviorid="FRModal" runat="server"
            cancelcontrolid="FRCancel" targetcontrolid="linkFlagsNew" popupcontrolid="FRPannel"
            repositionmode="None" backgroundcssclass="modalBackground" dropshadow="true" />

 

by: MuralidharanpPosted on 2009-08-17 at 03:33:47ID: 25112927

hi TheLearnedOne,

  i corrected that now, but still it doesn't show the modal popup.

 

by: TheLearnedOnePosted on 2009-08-17 at 05:45:49ID: 25113726

What is happening again?  Is it showing the popups at all?

 

by: MuralidharanpPosted on 2009-08-20 at 21:34:38ID: 25149172

hi TheLearnedOne
      when clicks the LinkButton "linkFlagsNew", the linkFlagsNew_Click gets Fired. And the Code inside that also get executed, i saw that using breakpoint.

        protected void linkFlagsNew_Click(object sender, EventArgs e)
       {
         int i = Convert.ToInt32(((LinkButton)sender).CommandArgument.ToString());             ((AjaxControlToolkit.ModalPopupExtender)gvNewest.Rows[i].FindControl("ModalPopupFR")).Show();
}

after execution when i come back to the browser it doesn't show the ModalPopup.

 

by: MuralidharanpPosted on 2009-08-20 at 21:50:42ID: 25149205

Hi TheLearnedOne.

I fixed the ModalPopup Problem by using ModalPopup at Outside of My GridView. i deleted the ModalPopup which is inside of GridView's ItemTemplate, and Put that after of the GridView. and in the LinkButton Click Event Code i used

  protected void linkFlagsNew_Click(object sender, EventArgs e)
      {
        int i = Convert.ToInt32(((LinkButton)sender).CommandArgument.ToString());
ModalPopupFR.FindControl("FRquestID") =gvNewest.Datakeys[i].value.ToString();
           ModalPopupFR.Show();
}

<GridView>
    <columns>
       <ItemTemplate>
                 <asp:LnkButton id="linkFlagsNew" >
        </ItemTemplate>
     </Columns>
</GridView>

<ModalPopup>
<panle>  // Panel for the ModalPopup

Now its Working Fine.
 <asp:gridview><ajaxtoolkit:modalpopup>
Anyway thanks very much for your Help and Replies. Thanks a lot TheLearnedOne.
<asp:panel></asp:panel></ajaxtoolkit:modalpopup></asp:gridview>

 

by: TheLearnedOnePosted on 2009-08-21 at 07:11:19ID: 25151956

Good job, grasshopper!!

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...