如何从代码运行模式

时间:2016-03-02 06:13:44

标签: c# asp.net

我有一个模态,我想从我的模态后面的代码中运行它:

ifstream *Stream = new ifstream(FullFileName, std::ios::in | std::ios::binary);

    std::ostringstream *oss = new ostringstream();
    *oss << Stream->rdbuf();
    string *Content = new string(oss->str());

    Stream->close();
    Request::request->set_body(*Content);

我的守则背后:

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>    
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <div dir="rtl" id="mymodal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalRapidAddLabel" aria-hidden="true">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="float: left">×</button>
            <h3 id="myModalRapidAddLabel">Edit Brand</h3>
        </div>
        <div class="modal-body">
            <p>Enter New Name</p>
            <div class="control-group">

                <div class="controls">
                    <asp:TextBox ID="txtnewname" runat="server"></asp:TextBox>

                </div>

            </div>
        </div>
        <div class="modal-footer">
            <button class="btn" data-dismiss="modal" aria-hidden="true">cancel</button>

        </div>
    </div></ContentTemplate>
</asp:UpdatePanel>

我剪切的每个地方都必须运行模态,但这对我来说不起作用?

1 个答案:

答案 0 :(得分:0)

试试这个,创建一个asp button

<asp:UpdatePanel runat="server">
                        <ContentTemplate>
                            <asp:Button runat="server" CssClass="btn btn-info" Text="Search" ID="cmdSearch" OnClick="cmdSearch_Click" />
                        </ContentTemplate>
                    </asp:UpdatePanel>

在你的代码背后:

        protected void cmdSearch_Click(object sender, EventArgs e)
    {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "",
                "$('#mymodal').modal('show');", true);
    }