[Back]

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="EditItem.ascx.cs" Inherits="AdefWebserver.Modules.SimpleSurvey.Edit" %>
<style type="text/css">
    .style1
    {
        height: 23px;
    }
</style>
<div align="left">
    <asp:Panel ID="pnlInsertEditQuestion" runat="server">
        <asp:LinkButton ID="lnkBack" runat="server" OnClick="lnkBack_Click">[Back]</asp:LinkButton>
        <br />
        <br />
        <asp:ListView ID="lvSurveyItems" runat="server" DataKeyNames="SurveyDataItemID" OnItemCommand="lvSurveyItems_ItemCommand"
            OnItemDeleting="lvSurveyItems_ItemDeleting" OnItemEditing="lvSurveyItems_ItemEditing"
            OnItemCanceling="lvSurveyItems_ItemCanceling" OnItemUpdating="lvSurveyItems_ItemUpdating"
            OnItemDataBound="lvSurveyItems_ItemDataBound" OnSorting="lvSurveyItems_Sorting"
            OnDataBound="lvSurveyItems_DataBound">
            <ItemTemplate>
                <tr style="">
                    <td nowrap="nowrap">
                        <asp:Button ID="DeleteButton" runat="server" OnClientClick='if (!confirm("Are you sure you want to delete? Any answers will also be deleted!") ){return false;}'
                            CommandName="Delete" Text="Delete" CommandArgument='<%# Eval("SurveyDataItemID") %>' />
                        <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
                    </td>
                    <td>
                        <asp:Label ID="DataNameLabel" runat="server" Text='<%# Eval("DataName") %>' />
                    </td>
                    <td align="center">
                        <asp:Label ID="TypeLabel" runat="server" Text='<%# Eval("Type") %>' />
                    </td>
                    <td align="center">
                        <asp:CheckBox ID="RequiredCheckBox" runat="server" Checked='<%# Eval("Required") %>'
                            Enabled="false" />
                    </td>
                    <td align="center">
                        <asp:CheckBox ID="VisibleCheckBox" runat="server" Checked='<%# Eval("Visible") %>'
                            Enabled="false" />
                    </td>
                    <td align="center" nowrap="nowrap">
                        <asp:Label ID="SortOrderLabel" runat="server" Text='<%# Eval("SortOrder") %>' Visible="False" />
                        <asp:ImageButton ID="imgUp" runat="server" CommandName="Sort" CommandArgument='<%# Eval("SurveyDataItemID") %>'
                            ImageUrl="~/DesktopModules/SimpleSurvey/Images/action_up.gif" />
                        <asp:ImageButton ID="imgDown" runat="server" CommandName="Sort" CommandArgument='<%# Eval("SurveyDataItemID") %>'
                            ImageUrl="~/DesktopModules/SimpleSurvey/Images/action_down.gif" />
                    </td>
                </tr>
            </ItemTemplate>
            <EmptyDataTemplate>
                <table runat="server" style="">
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                </table>
            </EmptyDataTemplate>
            <LayoutTemplate>
                <table runat="server">
                    <tr runat="server">
                        <td runat="server">
                            <table id="itemPlaceholderContainer" runat="server" border="0" style="">
                                <tr runat="server" style="">
                                    <th runat="server">
                                    </th>
                                    <th runat="server">
                                        Question
                                    </th>
                                    <th runat="server">
                                        Type
                                    </th>
                                    <th runat="server">
                                        Required
                                    </th>
                                    <th runat="server">
                                        Visible
                                    </th>
                                    <th runat="server">
                                    </th>
                                </tr>
                                <tr id="itemPlaceholder" runat="server">
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </LayoutTemplate>
            <EditItemTemplate>
                <tr style="">
                    <td nowrap="nowrap">
                        <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
                        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
                    </td>
                    <td>
                        <asp:Label ID="lblSurveyDataItemID" runat="server" Text='<%# Eval("SurveyDataItemID") %>'
                            Visible="False" />
                        <asp:TextBox ID="DataNameTextBox" runat="server" Text='<%# Bind("DataName") %>' Rows="2"
                            MaxLength="200" TextMode="MultiLine" />
                    </td>
                    <td align="center">
                        <asp:Label ID="TypeLabel" runat="server" Text='<%# Eval("Type") %>' />
                    </td>
                    <td align="center">
                        <asp:CheckBox ID="RequiredCheckBox" runat="server" Checked='<%# Bind("Required") %>' />
                    </td>
                    <td align="center">
                        <asp:CheckBox ID="VisibleCheckBox" runat="server" Checked='<%# Bind("Visible") %>' />
                    </td>
                    <td align="center" nowrap="nowrap">
                        <asp:LinkButton ID="lnkEditItems" runat="server" OnClick="lnkEditItems_Click" Text="[Edit Items]"
                            Visible="False" />
                    </td>
                </tr>
            </EditItemTemplate>
        </asp:ListView>
        <br />
        <br />
        <table runat="server" border="0" cellpadding="2" cellspacing="2">
            <tr id="Tr1" runat="server">
                <th id="Th1" runat="server" class="style1">
                    <b>Insert new item:</b>
                </th>
                <th id="Th2" runat="server" bgcolor="#CCCCCC" class="style1">
                    Question
                </th>
                <th id="Th3" runat="server" bgcolor="#CCCCCC" class="style1">
                    Type
                </th>
                <th id="Th4" runat="server" bgcolor="#CCCCCC" class="style1">
                    &nbsp;Required&nbsp;
                </th>
                <th id="Th5" runat="server" bgcolor="#CCCCCC" class="style1">
                    &nbsp;Visible&nbsp;
                </th>
            </tr>
            <tr style="">
                <td valign="top" nowrap="nowrap">
                    <asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" OnClick="InsertButton_Click" />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
                </td>
                <td valign="top">
                    <asp:TextBox ID="DataNameTextBox" runat="server" Text='<%# Bind("DataName") %>' Rows="2"
                        MaxLength="200" TextMode="MultiLine" />
                </td>
                <td valign="top" align="center" width="90">
                    <asp:DropDownList ID="ddlTypeInsert" runat="server" AutoPostBack="True" EnableViewState="True"
                        OnSelectedIndexChanged="ddlTypeInsert_SelectedIndexChanged">
                        <asp:ListItem>Text</asp:ListItem>
                        <asp:ListItem>Dropdown</asp:ListItem>
                        <asp:ListItem>Radio Buttons</asp:ListItem>
                        <asp:ListItem>Check Boxes</asp:ListItem>
                        <asp:ListItem>Integer</asp:ListItem>
                        <asp:ListItem>Double</asp:ListItem>
                        <asp:ListItem>Money</asp:ListItem>
                        <asp:ListItem>Email</asp:ListItem>
                        <asp:ListItem>Date</asp:ListItem>
                        <asp:ListItem>Website</asp:ListItem>
                        <asp:ListItem>Image</asp:ListItem>
                    </asp:DropDownList>
                    <asp:LinkButton ID="lnkInsertEditItems" runat="server" OnClick="lnkInsertEditItems_Click"
                        Text="[Edit Items]" />
                </td>
                <td align="center" valign="top">
                    <asp:CheckBox ID="RequiredCheckBox" runat="server" Checked='<%# Bind("Required") %>' />
                </td>
                <td align="center" valign="top">
                    <asp:CheckBox ID="VisibleCheckBox" runat="server" Checked='True' />
                </td>
            </tr>
        </table>
        <div align="left">
            <asp:Label ID="lblError" runat="server" EnableViewState="False" ForeColor="Red"></asp:Label>
        </div>
    </asp:Panel>
    <asp:Panel ID="pnlInsertEditItems" runat="server" Visible="False">
        <asp:LinkButton ID="lnkBackToQuestions" runat="server" OnClick="lnkBackToQuestions_Click">[Back]</asp:LinkButton>
        <br />
        <br />
        <asp:Label ID="lblQuestion" runat="server" Font-Bold="True"></asp:Label>
        <br />
        <asp:ListView ID="lvSurveyChoices" runat="server" InsertItemPosition="LastItem" OnItemDeleting="lvSurveyChoices_ItemDeleting"
            OnItemInserting="lvSurveyChoices_ItemInserting">
            <ItemTemplate>
                <tr style="">
                    <td>
                        <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="Delete" />
                    </td>
                    <td>
                        <asp:Label ID="SurveyChoiceIDLabel" runat="server" Text='<%# Eval("SurveyChoiceID") %>'
                            Visible="False" />
                        <asp:Label ID="choiceLabel" runat="server" Text='<%# Eval("choice") %>' />
                    </td>
                </tr>
            </ItemTemplate>
            <EmptyDataTemplate>
                <table runat="server" style="">
                    <tr>
                        <td>
                            No data was returned.
                        </td>
                    </tr>
                </table>
            </EmptyDataTemplate>
            <InsertItemTemplate>
                <tr style="">
                    <td>
                        <asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" />
                    </td>
                    <td>
                        <asp:TextBox ID="choiceTextBox" runat="server" MaxLength="20" Text='<%# Bind("choice") %>' />
                    </td>
                </tr>
            </InsertItemTemplate>
            <LayoutTemplate>
                <table runat="server">
                    <tr runat="server">
                        <td runat="server">
                            <table id="itemPlaceholderContainer" runat="server" border="0" style="">
                                <tr runat="server" style="">
                                    <th runat="server">
                                    </th>
                                    <th runat="server">
                                    </th>
                                </tr>
                                <tr id="itemPlaceholder" runat="server">
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr runat="server">
                        <td runat="server" style="">
                        </td>
                    </tr>
                </table>
            </LayoutTemplate>
        </asp:ListView>
        <asp:Label ID="lblErrorSurveyChoices" runat="server" EnableViewState="False" ForeColor="Red"></asp:Label>
        <br />
    </asp:Panel>
</div>