<%@ Page Language="c#" Codebehind="EditCategoryLinks.aspx.cs" AutoEventWireup="True"
    Inherits="Tjenestetorget.Administrator.EditCategoryLinks" MasterPageFile="~/Site.master" %>

<asp:Content ID="content1" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Panel ID="pnlHeading" runat="server" Width="100%">
        <h4>
        </h4>
    </asp:Panel>
    <asp:Panel ID="pnlMessage" runat="server">
        <asp:Label ID="lblMessage" runat="server" ForeColor="Red"></asp:Label>
    </asp:Panel>
    <asp:Panel ID="pnlContent" runat="server" Width="100%">
        <table>
            <tr>
                <td>
                    <asp:Label ID="lblLinkName" runat="server">Linknavn: </asp:Label></td>
                <td>
                    <asp:TextBox ID="txtLinkName" runat="server" Width="200"></asp:TextBox></td>
                <td>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Display="Dynamic"
                        ControlToValidate="txtLinkName" ValidationGroup="New" ErrorMessage="Du må angi et navn."></asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="lblUrl" runat="server">Url: </asp:Label></td>
                <td>
                    <asp:TextBox ID="txtUrl" runat="server" Width="200"></asp:TextBox></td>
                <td>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" Display="Dynamic"
                        ControlToValidate="txtUrl" ValidationGroup="New" ErrorMessage="Du må angi URL"></asp:RequiredFieldValidator>
                    <asp:CustomValidator ID="urlValidator" runat="server" ControlToValidate="txtUrl" ValidationGroup="New"
                        ErrorMessage="Feil format på URL (husk protokoll, http, ftp, etc)" OnServerValidate="CheckUrl"></asp:CustomValidator></td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="lblTarget_blank" runat="server">Åpne i nytt vindu</asp:Label></td>
                <td>
                    <asp:CheckBox ID="chkTarget_blank" runat="server" Text="Ja" Checked="True"></asp:CheckBox></td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="lblLinkType" runat="server">Linktype (f eks 'doc'):</asp:Label></td>
                <td>
                    <asp:DropDownList ID="ddlLinkType" runat="server">
                        <asp:ListItem Value="- Ikke valgt -" />
                        <asp:ListItem Value="doc" />
                        <asp:ListItem Value="xls" />
                        <asp:ListItem Value="ppt" />
                        <asp:ListItem Value="pdf" />
                        <asp:ListItem Value="txt" />
                        <asp:ListItem Value="html" />
                        <asp:ListItem Value="annen" />
                    </asp:DropDownList></td>
            </tr>
        </table>
        <br/>
        <table>
            <tr>
                <td>
                    Kommentar
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:TextBox ID="txtComment" runat="server" TextMode="MultiLine" Rows="10" Columns="50"></asp:TextBox></td>
            </tr>
            <tr>
                <td>
                </td>
                <td align="right">
                    <asp:LinkButton ID="lnkBtnSave" runat="server" CausesValidation="True" ValidationGroup="New" OnClick="lnkBtnSave_Click">[Lagre]</asp:LinkButton></td>
            </tr>
        </table>
        <br/>
        <asp:Panel ID="pnlDgMessage" runat="server">
			<asp:Label ID="lblDgMessage" runat="server" ForeColor="Red"></asp:Label>
		</asp:Panel>
        <br/>
        <asp:DataGrid ID="dgLinks" runat="server" Width="90%" GridLines="Horizontal" ItemStyle-BackColor="Gainsboro"
            AlternatingItemStyle-BackColor="White" AutoGenerateColumns="False" DataKeyField="KommuneSkjemaID">
            <AlternatingItemStyle BackColor="White"></AlternatingItemStyle>
            <ItemStyle BackColor="Gainsboro"></ItemStyle>
            <HeaderStyle Font-Size="X-Small" Font-Bold="True"></HeaderStyle>
            <Columns>
                <asp:TemplateColumn HeaderText="Linknavn">
                    <ItemTemplate>
                        <asp:Label ID="lblName" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Name") %>'>
                        </asp:Label>
                    </ItemTemplate>
					<EditItemTemplate>
						<asp:TextBox ID="dgTxtLinkName" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Name") %>'>
						</asp:TextBox>
						<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" Display="Dynamic"
							ControlToValidate="dgTxtLinkName" ValidationGroup="Update" ErrorMessage="Du må angi et navn.">
						</asp:RequiredFieldValidator>
					</EditItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="Url">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Url") %>'>
                        </asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
						<asp:TextBox ID="dgTxtUrl" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Url") %>'>
						</asp:TextBox>
						<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" Display="Dynamic"
							ControlToValidate="dgTxtUrl" ValidationGroup="Update" ErrorMessage="Du må angi URL">
						</asp:RequiredFieldValidator>
						<asp:CustomValidator ID="urlValidatorUpdate" runat="server" ControlToValidate="dgTxtUrl" ValidationGroup="Update"
							ErrorMessage="Feil format på URL (husk protokoll, http, ftp, etc)" OnServerValidate="CheckUrlOnUpdate">
						</asp:CustomValidator>
					</EditItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="Opprettet">
                    <ItemTemplate>
                        <asp:Label ID="lblCreatedOn" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.CreatedOn") %>'>
                        </asp:Label>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="&#197;pne i nytt vindu">
                    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    <ItemTemplate>
                        <asp:CheckBox ID="dgChkTarget_blankDisabled" runat="server" Enabled="false" Checked='<%# DataBinder.Eval(Container, "DataItem.OpenInNewWindow") %>'>
                        </asp:CheckBox>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:CheckBox ID="dgChkTarget_blank" runat="server" Enabled="true" Checked='<%# DataBinder.Eval(Container, "DataItem.OpenInNewWindow") %>'>
                        </asp:CheckBox>
                    </EditItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="Linktype">
                    <ItemTemplate>
                        <asp:Label ID="dgLblLinkType" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.FileType") %>'>
                        </asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
						<asp:DropDownList ID="dgDdlLinkType" runat="server" SelectedValue='<%# DataBinder.Eval(Container, "DataItem.FileType") %>'>
							<asp:ListItem Value="- Ikke valgt -" />
							<asp:ListItem Value="doc" />
							<asp:ListItem Value="xls" />
							<asp:ListItem Value="ppt" />
							<asp:ListItem Value="pdf" />
							<asp:ListItem Value="txt" />
							<asp:ListItem Value="html" />
							<asp:ListItem Value="annen" />
						</asp:DropDownList>
                    </EditItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="Kommentar">
                    <ItemTemplate>
                        <asp:Label ID="lblComment" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Comment") %>'>
                        </asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
						<asp:TextBox ID="dgTxtComment" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Comment") %>'>
						</asp:TextBox>
					</EditItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn>
                    <ItemTemplate>
                        <asp:ImageButton runat="server" ImageUrl="images/icons/slett.gif" CommandName="Delete"
                            OnCommand="lnkDelete_Click" CausesValidation="False" AlternateText="Slett" Width="14px"
                            Height="14px" ID="lnkDelete" CommandArgument='<%# DataBinder.Eval(Container, "DataItem.KommuneSkjemaID") %>'>
                        </asp:ImageButton>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:EditCommandColumn ItemStyle-Width="40px" ButtonType="LinkButton" UpdateText="<img src='images/icons/lagre.gif' border='0'/>"
                    CancelText="<img src='images/icons/avbryt.gif' border='0'/>" ValidationGroup="Update" EditText="<img src='images/icons/endre.gif' border='0'/>">
                </asp:EditCommandColumn>
            </Columns>
            <PagerStyle HorizontalAlign="Left" ForeColor="#000066" BackColor="White" Mode="NumericPages">
            </PagerStyle>
        </asp:DataGrid>
    </asp:Panel>
</asp:Content>
