如何在aspx页面中访问用户控件方法 [英] how do I access user control method in aspx page

查看:70
本文介绍了如何在aspx页面中访问用户控件方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有模态弹出窗口的用户控件,用于在必要时显示弹出窗口。



I have user control with modal popup which is used to show popup whenever necessary.

<div class="modal fade" id="myModal" role="dialog" aria-labelledby="myModalLabel"

    aria-hidden="true">
    <div class="modal-dialog modal-sm">
         <asp:UpdatePanel ID="upModal" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
            <ContentTemplate>
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    ×</button>
                <h4 class="modal-title">
                    <asp:Label ID="lblModalTitle" runat="server"></asp:Label></h4>
            </div>
            <div class="modal-body">
                <asp:Label ID="lblModalBody" runat="server"></asp:Label>
            </div>
            <div class="modal-footer">
                <button class="btn btn-info" data-dismiss="modal" aria-hidden="true">
                    Close</button>
            </div>
        </div>
        </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</div>





返回结束





And back end

private string _Title = null;

public string Title
        {
        get
            {
            return _Title;
            }
        set
            {
            _Title = value;
            }
        }

private string _message = null;

public string Message
        {
        get
            {
            return _message;
            }
        set
            {
            _message = value;
            }
        }
protected void Page_Load(object sender, EventArgs e)
        {
        if (_Title != null)
            {
            lblModalTitle.Text = _Title;
            lblModalBody.Text = _message;
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal({backdrop: 'static',keyboard: false});", true);
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').on('shown.bs.modal', function () { $('#lblModalTitle').focus();})", true);
            upModal.Update();
            }
        }











现在我有了aspx页面。用户点击后,生成服务器点击事件,操作结束后我想用这个用户控件显示弹出窗口。



我应该怎么做?目前我用方法实现了接口并覆盖了该方法并在aspx页面中访问了它。






Now I have aspx page. after the user clicks, server click event generates and after the operation ends I want to show popup with this user control.

what should I have to do that ? currently I implemented interface with method and overridden that method and accessed that in aspx page.

推荐答案

('#myModal')。modal({backdrop:'static', keyboard:false});, true );
ScriptManager.RegisterStartupScript(Page,Page.GetType(), myModal
('#myModal').modal({backdrop: 'static',keyboard: false});", true); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "


('#myModal')。on('shown.bs.modal',function(){
('#myModal').on('shown.bs.modal', function () {


('#lblModalTitle' ).focus();}), true );
upModal.Update();
}
}
('#lblModalTitle').focus();})", true); upModal.Update(); } }











现在我有用户点击后,服务器点击事件生成,操作结束后我想用这个用户控件显示弹出窗口。



我应该怎么做那个?目前我用方法实现了接口并覆盖了该方法,并在aspx页面中访问了它。






Now I have aspx page. after the user clicks, server click event generates and after the operation ends I want to show popup with this user control.

what should I have to do that ? currently I implemented interface with method and overridden that method and accessed that in aspx page.


这篇关于如何在aspx页面中访问用户控件方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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