Click here to Skip to main content
16,004,820 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="NoticeboardDocs.aspx.vb"
    Inherits="CBRE.TSP.Web.NoticeboardDocs" %>
     <%@ Import Namespace="Common" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Noticeboard Documents</title>
    <link type="text/css" href="../Styles/grid/css/grid.css" rel="stylesheet" />
    <link type="text/css" href="../Styles/grid/css/round.css" rel="stylesheet" />
    <link type="text/css" href="../Styles/grid/css/core.css" rel="stylesheet" />
    <link href="../Styles/reskin/screen.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript">

        function ShowDocument(docId) {
            if (docId > 0 || docId != "") {
                var isMobileLogin = '<%= Session("isMobile") %>';

                var isMob = false;
                if (isMobileLogin != 'undefined') {
                    if (isMobileLogin == "true") {
                        isMob = true;
                    }
                }

                if (isMob == true) {
                    $("<div class='full-popup'><div class='file-popup'><a href='#' onclick='javascript:closeHandler();' class='close-full-popup'>"> Close</a><div class='iframe-holder' style='overflow:auto; -webkit-overflow-scrolling:touch;'><iframe scrolling='yes'></iframe></div></div></div>").appendTo("body");

                    var src = "../User/ShowDocument.aspx?DocumentID=" + docId;
                    $(".full-popup iframe").attr("src", src + "#view=fit");

                    $(document).on("click", ".close-full-popup", function () {
                        $(this).parents(".full-popup").detach();
                        return false;
                    });
                }
                else {
                    window.open("../User/ShowDocument.aspx?DocumentID=" + docId, "_blank", "height=700,width=900,location=no,menubar=no,resizable=yes,scrollbars=yes,titlebar=no,toolbar=no,top=50,left=50");
                }
            }
        }

        function closeHandler() {
            $.ajax(
            {
                type: 'post',
                url: '../User/ShowDocument.aspx/DeleteOpenedFile',
                contentType: "application/json; charset=utf-8",
                datatype: 'json',
                success: function (result) {
                }
            })
        };
    </script>
</head>
<body>
<asp:PlaceHolder ID="PlaceHolder1" runat="server">
    <form id="form1" runat="server">
    <div id="mainfr_right">
        <div class="wsmdivmain">
            <p id="pagetitle">
                <asp:Label runat="server" ID="lblPageTitle" Text="Documents Attached"></asp:Label>
            </p>
            <br />
            <asp:GridView ID="gvDocs" runat="server" CaptionAlign="Top" CellPadding="1" CellSpacing="2"
                AutoGenerateColumns="False" Width="100%" DataKeyNames="DocumentId">
                <HeaderStyle CssClass="webGridheaderStyle" HorizontalAlign="Center" />
                <RowStyle CssClass="webGridrowStyle" Wrap="true" />
                <AlternatingRowStyle CssClass="webGridalternatingStyle" HorizontalAlign="Center" />
                <Columns>
                    <asp:TemplateField HeaderText="Filename">
                        <ItemTemplate>
                            <asp:HyperLink ID="HyperLink1"  runat="server" NavigateUrl='Javascript:void(0);' 
                                onclick='<%# "ShowDocument("""  &  Encryption.EncryptParameter(DataBinder.Eval(Container.DataItem, "DocumentID")) & """); return false;"%>'
                                Target="_blank" Text='<%# Eval("DocumentName") %>'>
                            </asp:HyperLink>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:BoundField DataField="Filesize" HeaderText="Size (bytes)" ItemStyle-HorizontalAlign="center">
                        <ItemStyle HorizontalAlign="center"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField DataField="Created" HeaderText="Date Uploaded" ItemStyle-HorizontalAlign="center">
                        <ItemStyle HorizontalAlign="center"></ItemStyle>
                    </asp:BoundField>
                </Columns>
            </asp:GridView>
        </div>
    </div>
    </form>
    </asp:PlaceHolder>
</body>
</html>



Protected Overrides Sub OnInit(e As System.EventArgs)
        MyBase.OnInit(e)

        Dim css As New HtmlLink
        Dim stylesheet As String = ThemeWrapper.GetMyTheme.TenantStyleSheet

        If String.IsNullOrEmpty(stylesheet) Then Exit Sub

        With css
            .Href = stylesheet
            .Attributes("rel") = "stylesheet"
            .Attributes("type") = "text/css"
        End With

        MyBase.Header.Controls.Add(css)

    End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Not Page.IsPostBack Then

            Dim iNoticeboardId = Request.QueryString("NoticeboardId")
            LoadDocsGrid(iNoticeboardId)

        End If
    End Sub


What I have tried:

i have put
Quote:
<asp:PlaceHolder ID="PlaceHolder1" runat="server">
in body but i did not worked !!
Posted
Updated 19-Apr-17 23:25pm

1 solution

The error is self-explanatory, you are trying to add a control to the head element but head contains code blocks

var isMobileLogin = '<%= Session("isMobile") %>';


Move your script tag out of the header and put it somewhere else like at the top of the body.
 
Share this answer
 
Comments
Akhil Jain 20-Apr-17 5:43am    
thanks man !!

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