Click here to Skip to main content
14,826,492 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All

I am hoping someone can help, I am working with nested repeaters and modal popups and what I am trying to do is click an imageButton in my nested repeater wich fires the repeater_ItemCommand event in turn shows the modal window. I cannot get this to work. Here is some of my code:

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
   <asp:Panel ID="pnl_Process" runat="server" Visible="true">
                        <asp:Repeater ID="rep_Process" runat="server" OnItemCommand="rep_Process_ItemCommand">
                                <div class="Objectives">
                                    <asp:Label ID="hdn_ProObjID" runat="server" Text='<%# Eval("ObjectiveID") %>' Visible="false" />
                                    <asp:Label ID="lbl_ProObjective" Text='<%# Eval("ObjectiveName") %>' runat="server" CssClass="TextDeco" /><br />
                                    <div class="GridView">
                                      <asp:Repeater ID="rep_ProTarget" runat="server" OnItemCommand="repProTarget_ItemCommand">
                                                <asp:Table ID="tbl_ProTargetBody" Width="800px" runat="server" CssClass="GridLayout">
                                                            <asp:ImageButton ID="img_ProToolTip" ImageUrl="~/Images/tooltip_icon.jpg" ToolTip="View Action Plan" runat="server" CommandName="ShowAction" CommandArgument='<%# Eval ("TargetID") %>' />
                                                            <asp:Button ID="btn_Fake" runat="server" Visible="false" />
                                                            <asp:Panel ID="pnl_Action" runat="server" Width="400px" style="display: none" cssClass="ModalWindow">
                                                                     <u><b>ACTION PLAN (PERSPECTIVE)</b></u>
                                                                  <asp:LinkButton ID="btn_Close" Text="Close" runat="server" />
                                                            <ajaxToolkit:ModalPopupExtender ID="ajx_Action" BehaviorID="ajx_Action" runat="server" TargetControlID="btn_Fake" PopupControlID="pnl_Action" CancelControlID="btn_Close" BackgroundCssClass="modalBackground" />

protected void rep_Process_ItemCommand(object sender, RepeaterCommandEventArgs e)

            foreach (RepeaterItem repProItem in rep_Process.Items)
                Repeater repProTarget = (Repeater)(repProItem.FindControl("rep_ProTarget"));
                Label oid = (Label)(repProItem.FindControl("hdn_ProObjID"));
                repProTarget.ItemCommand += new RepeaterCommandEventHandler(repProTarget_ItemCommand);

                foreach (RepeaterItem repProChildItem in repProTarget.Items)
                    Label tid = (Label)(repProChildItem.FindControl("lbl_proTargetID"));
                    DropDownList rid = (DropDownList)(repProChildItem.FindControl("drp_ProRisk"));
                    Label rowID = (Label)(repProChildItem.FindControl("lbl_ProRowID"));
                    ImageButton imgTip = (ImageButton)(repProChildItem.FindControl("img_ProToolTip"));
                        BSDataConnDataContext db = new BSDataConnDataContext();

                        ScorecardReturn updSC = db.ScorecardReturns.Single(s => s.ID.Equals(Convert.ToInt16(rowID.Text)));
                        updSC.RiskID = Convert.ToInt16(rid.SelectedItem.Value);
                        updSC.UserID = "ro029004";


                    catch (Exception ex)

protected void repProTarget_ItemCommand(object sender, RepeaterCommandEventArgs e)
            if (e.CommandName == "ShowAction")
                ImageButton imgTip = e.Item.FindControl("img_ProToolTip")as ImageButton;
                imgTip = sender as ImageButton;
                AjaxControlToolkit.ModalPopupExtender modPop = e.Item.FindControl("ajx_Action") as AjaxControlToolkit.ModalPopupExtender;

Any help will be greatly appreciated.

Many Thanks
Updated 22-May-12 9:40am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900