How to assign mutliple HTMLAnchors in a Calendar Render to a ModalPopup TargetControlID???

Last post 07-05-2009 4:55 AM by solgen. 0 replies.

Sort Posts:

  • How to assign mutliple HTMLAnchors in a Calendar Render to a ModalPopup TargetControlID???

    07-05-2009, 4:55 AM
    • Member
      point Member
    • solgen
    • Member since 07-05-2009, 4:32 AM
    • Posts 1

     Hi I am new here.

    I am currently developing a web page that has a Calendar where in for each Date I have an HTMLAchor inside the Cells with the text "Add Event". I used the Calendar Render to add the controls (e.Cell.Controls.Add(anchor).

    Here is the code segment.

    if (e.Day.Date >= DateTime.Today)
    {
                HtmlAnchor anchor = new HtmlAnchor();
                anchor.ID = "Event";
                anchor.InnerHtml = "Add Event";
                string method = "showEventCalendarForm(event,'" + e.Day.Date.ToShortDateString() + "')";
    
                anchor.HRef = "#";
                anchor.Attributes.Add("onclick", method);
                e.Cell.Controls.Add(anchor);
    }

    The use of the Control is to add an event to the Date's Cell. What I want to do is to set a ModalPopup Form that will be used in order to input the details that will be saved into a database. However the ModalPopupExtender only allows TargetControlID to trigger an event.    

    Code Segment for my ASPX Page.

    <style type="text/css">
            .modalBackground
            {
                background-color: Gray;
                filter: alpha(opacity =70);
                opacity: 0.7;
                width: 100%;
            }
            .modalPopup
            {
                background-color: White;
                border-style: solid; 
                border-color: Black;
                width: 530px;
                            
            }
            .modalHeader
            {
                background-color: #CC0000;
                border-style: solid;
                width: 524px;
            }
            .eventForm
            {
                border: solid; 
                border-color: Black; 
                background-color: #FFFFFF; 
                width: 524px;
            }
        </style>
    
    <body>
        <asp:Label ID="lblHeader" runat="server" Text="Agency Training & Development Calendar" BackColor="#CC0000" Font-Bold="True" Font-Size="Large" ForeColor="White" Width="100%"></asp:Label>
        <form id="AgentForm" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
        <!--<div id="EventCalendarForm" class="eventForm">-->
        <asp:Panel ID="EventCalendarForm" CssClass="modalPopup" runat="server">
            <asp:Panel ID="panelHeader" CssClass="modalHeader" runat="server">
                <table width="100%">
                    <tr>
                        <td align="left">
                            <b style="color: White; font-size: large;">Add Event</b>
                        </td>
                        <!--<td align="right">
                            <a href="#" onclick ="hideEventCalendarForm()" ><img src="images/close.gif" style="width: 18px; border: 0;" /></a>
                        </td>-->
                    </tr>
                </table>
            </asp:Panel>
            <div class="eventForm">
            <table>
                <tr>
                    <td>
                    </td>
                </tr>
                <tr>
                <td>
                    <b>Event Title:</b>
                </td>
                <td>
                    <asp:TextBox ID="tbTrainingName" runat="server"></asp:TextBox> 
                    <asp:Label ID="lblError1" runat="server" Text="*Please enter an event title" Font-Italic="True" ForeColor="Red"></asp:Label>
                    </td>
            </tr>
            <tr>
                <td>
                    <b>Start Date:</b>
                </td>
                <td>
                    <cc1:CalendarExtender ID="ceStarDate" runat="server" TargetControlID="tbTrainingStartDate">
                    </cc1:CalendarExtender>
                    <asp:TextBox ID="tbTrainingStartDate" runat="server"></asp:TextBox> 
                    <asp:Label ID="lblError2" runat="server" Text="*Please enter the starting date" Font-Italic="True" ForeColor="Red"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    <b>End Date:</b>
                </td>
                <td>
                    <cc1:CalendarExtender ID="ceEndDate" runat="server" TargetControlID="tbTrainingEndDate">
                    </cc1:CalendarExtender>
                    <asp:TextBox ID="tbTrainingEndDate" runat="server"></asp:TextBox> 
                    <asp:Label ID="lblError3" runat="server" Text="*Please enter the end date " Font-Italic="True" ForeColor="Red"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    <b>Time:</b>
                </td>
                <td>
                    <asp:DropDownList ID="ddlTime" runat="server" oninit="ddlTime_Init">
                    </asp:DropDownList>
                    <asp:DropDownList ID="ddlAMPM" runat="server">
                        <asp:ListItem>AM</asp:ListItem>
                        <asp:ListItem>PM</asp:ListItem>
                    </asp:DropDownList> <b>To</b>
                    <asp:DropDownList ID="ddlTime2" runat="server" oninit="ddlTime2_Init">
                    </asp:DropDownList>
                    <asp:DropDownList ID="ddlAMPM2" runat="server">
                        <asp:ListItem>AM</asp:ListItem>
                        <asp:ListItem>PM</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    <b>Duration:</b>
                </td>
                <td>
                    <asp:TextBox ID="tbDuration" runat="server" Width="50px"></asp:TextBox> 
                    <asp:Label ID="lblError4" runat="server" Text="*Please enter the duration" Font-Italic="True" ForeColor="Red"></asp:Label>
                    </td>
            </tr>
            <tr>
                <td>
                    <b>Min. Pax:</b>
                </td>
                <td>
                    <asp:TextBox ID="tbPax" runat="server" Width="50px"></asp:TextBox> 
                    <asp:Label ID="lblError5" runat="server" Text="*Please enter the Min. Pax" Font-Italic="True" ForeColor="Red"></asp:Label>
                    </td>
            </tr>
            <tr>
                <td>
                    <b>Type:</b>
                </td>
                <td>
                    <asp:DropDownList ID="ddlType" runat="server">
                        <asp:ListItem>select type</asp:ListItem>
                        <asp:ListItem>Internal</asp:ListItem>
                        <asp:ListItem>External</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    <b>Course:</b>
                </td>
                <td>
                    <asp:DropDownList ID="ddlCourse2" runat="server">
                        <asp:ListItem>select course</asp:ListItem>
                        <asp:ListItem>Management</asp:ListItem>
                        <asp:ListItem>Computer</asp:ListItem>
                        <asp:ListItem>Communication</asp:ListItem>
                        <asp:ListItem></asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    <b>Venue:</b>
                </td>
                <td>
                    <asp:DropDownList ID="ddlVenue2" runat="server">
                        <asp:ListItem>select venue</asp:ListItem>
                        <asp:ListItem>Auditorium</asp:ListItem>
                        <asp:ListItem>Conference Room</asp:ListItem>
                        <asp:ListItem>Office Hall</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <asp:Button ID="btnAdd" runat="server" Text="Add" Width="60px" 
                        onclick="btnAdd_Click" />
                    <asp:Button ID="btnCancel" runat="server" Text="Cancel" Width="60px" 
                        onclick="btnCancel_Click" />
                    <br />
                    <asp:Label ID="lblError6" runat="server" Text="*Please check if you selected the correct type, course, and venue" Font-Italic="True" ForeColor="Red"></asp:Label>
                    <br />
                    <asp:Label ID="lblError7" runat="server" Text="*Please check if you set the appropriate start date, end date, or time" Font-Italic="True" ForeColor="Red"></asp:Label>
                </td>
            </tr>
            </table>
            </div>
        </asp:Panel>
        <!--</div>-->
        <cc1:ModalPopupExtender ID="mpuEventForm" runat="server" BackgroundCssClass="modalBackground" TargetControlID="" PopupControlID="EventCalendarForm" OkControlID="btnAdd" CancelControlID="btnCancel" PopupDragHandleControlID="panelHeader">
        </cc1:ModalPopupExtender>
    <form>
    </body>

     
    My question is what to assign to the TargetControlID of the ModalPopUpExtender in order for the form to work if there are multiple buttons???
    Your help will be much appreciated.
    Thanks,
    Ryan
    
    


     

Page 1 of 1 (1 items)