无法修改控件集合,因为控件包含代码块(即<%...%>)。 [英] The controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

查看:62
本文介绍了无法修改控件集合,因为控件包含代码块(即<%...%>)。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<%@ Page Language =vbAutoEventWireup =falseCodeBehind =NoticeboardDocs.aspx.vb
Inherits =CBRE.TSP.Web.NoticeboardDocs%> ;
<%@ Import Namespace =Common%>
< html xmlns =http://www.w3.org/1999/xhtml>
< head id =Head1runat =server>
< title>布告牌文件< / title>
< link type =text / csshref =../ Styles / grid / css / grid.css =stylesheet/>
< link type =text / csshref =../ Styles / grid / css / round.css =stylesheet/>
< link type =text / csshref =../ Styles / grid / css / core.css =stylesheet/>
< link href =../ Styles / reskin / screen.csstype =text / css =stylesheet/>
< script type =text / javascript>

函数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'> 关闭< / a>< div class ='iframe-holder'style ='overflow:auto; -webkit-overflow-scrolling:touch;'>< iframe scrolling ='yes'>< / iframe> < / DIV>< / DIV>< / DIV> 中。)appendTo( 身);

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();
返回false;
});
}
else {
window.open(../ User / ShowDocument.aspx?DocumentID =+ docId,_ blank,height = 700,width = 900,location =没有,菜单栏=没有,可调整大小=是,滚动条=是,标题栏=没有,工具栏=没有,顶部= 50,左= 50\" );
}
}
}

函数closeHandler(){
$ .ajax(
{
type:'post' ,
url:'.. / User / ShowDocument.aspx / DeleteOpenedFile',
contentType:application / json; charset = utf-8,
datatype:'json',
成功:功能(结果){
}
})
};
< / script>
< / head>
< body>
< asp:PlaceHolder ID =PlaceHolder1runat =server>
< form id =form1runat =server>
< div id =mainfr_right>
< div class =wsmdivmain>
< p id =pagetitle>
< asp:Label runat =serverID =lblPageTitleText =Documents Attached>< / asp:Label>
< / p>
< br />
< asp:GridView ID =gvDocsrunat =serverCaptionAlign =TopCellPadding =1CellSpacing =2
AutoGenerateColumns =FalseWidth =100%DataKeyNames = DocumentId >
< HeaderStyle CssClass =webGridheaderStyleHorizo​​ntalAlign =Center/>
< RowStyle CssClass =webGridrowStyleWrap =true/>
< AlternatingRowStyle CssClass =webGridalternatingStyleHorizo​​ntalAlign =Center/>
< Columns>
< asp:TemplateField HeaderText =Filename>
< ItemTemplate>
< asp:HyperLink ID =HyperLink1runat =serverNavigateUrl ='Javascript:void(0);'
onclick ='<%#ShowDocument(& Encryption .EncryptParameter(DataBinder.Eval(Container.DataItem,DocumentID))&);返回false;%>'
Target =_ blankText ='<%#Eval( DocumentName)%>'>
< / asp:HyperLink>
< / ItemTemplate>
< ItemStyle Horizo​​ntalAlign =Center/>
< / asp:TemplateField>
< asp:BoundField DataField =FilesizeHeaderText =Size(bytes)ItemStyle-Horizo​​ntalAlign =center>
< ItemStyle Horizo​​ntalAlign =center>< / ItemStyle>
< / asp:BoundField>
< asp:BoundField DataField =CreatedHeaderText =Date UploadedItemStyle-Horizo​​ntalAlign =center>
< ItemStyle Horizo​​ntalAlign =center>< / ItemStyle>
< / asp:BoundField>
< / Columns>
< / asp:GridView>
< / div>
< / div>
< / form>
< / asp:PlaceHolder>
< / body>
< / html>







受保护的覆盖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)然后退出Sub

使用css
.Href = stylesheet
。属性(rel)=stylesheet
。属性(type)=text / css


结束MyBase.Header.Controls.Add(css)

End Sub
受保护的子Page_Load(ByVal sender As Object,ByVal e As System.EventArgs)处理Me.Load

如果不是Page.IsPostBack那么

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

结束如果
结束子





我尝试过:



i已经把

引用:

< asp:PlaceHolder ID =PlaceHolder1runat =server>

,但我做了没有工作!!

解决方案

(< div class ='full-popup'>< div class ='file-popup'>< a href ='#'onclick ='javascript:closeHandler();'class ='close-full-popup'> 关闭< / 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(){

<%@ 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 !!

解决方案

("<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 () {


这篇关于无法修改控件集合,因为控件包含代码块(即&lt;%...%&gt;)。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆