与LinkBut​​ton的打开弹出 [英] Open popup with linkbutton

查看:185
本文介绍了与LinkBut​​ton的打开弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的引导模式弹出,这 DIV 是(例如)弹出[使用中继]

I am using bootstrap modal popup, and this div is (FOR EXAMPLE) a popup [using a repeater]

<div id="messageContent">Hello World!</div>

这个弹出可以这样做(这工作)打开:

This pop-up can be opened by doing this (this works):

<a href="#messageContent" role="button" class="btn" data-toggle="modal">Open Popup</a>

但我想通过一些的DataBinder.Eval - 值与&LT; A HREF =&GT;&LT; / A&GT; ,这是不可能的,所以这是我尝试用的LinkBut​​ton

But I want to pass some DataBinder.Eval-values with the <a href=""></a>, and this is not possible, so this is what I tried with a linkbutton:

<asp:LinkButton ID="lbOpenMessage" runat="server" CommandName="OpenMessage" CommandArgument='<%#Eval("MessageID")%>'>Open Popup</asp:LinkButton>

但我不体健调用&LT; A HREF =#在messageContent&GT;&LT; / A&GT; 中的LinkBut​​ton打开弹出。

But I am not abled to call the <a href="#messageContent"></a> in the linkbutton to open the pop-up.

当我做这样的事情:

<asp:LinkButton ID="lbOpenMessage" runat="server" CommandName="OpenMessage" CommandArgument='<%#Eval("MessageID")%>'>
<a href="#messageContent" role="button" class="btn" data-toggle="modal">Open Popup</a>
</asp:LinkButton>

然后 e.Commandname -event不会被解雇,所以我没有得到邮件ID。

Then the e.Commandname-event doesn't get fired, so I don't get the MessageID.

我能做些什么来打开弹出与&LT; A HREF =#在messageContent&GT;&LT; / A&GT; ,与传递的DataBinder.Eval - 值?

What can I do to open the pop-up with <a href="#messageContent"></a>, with passing the DataBinder.Eval-values?

我做了一些研究,但没有发现任何东西。

I did some research, but couldn't find anything.

推荐答案

您需要通过JavaScript调用显示模式,而不是标记快捷方式。这里指的 http://getbootstrap.com/javascript/#modals

You need to show the modal via a javascript call as opposed to the markup shortcuts. refer here http://getbootstrap.com/javascript/#modals

要调用的函数是$('#myModal')。模态(选项)

the function you want to call is $('#myModal').modal(options)

因此​​,在您的项目命令事件你想要的以下内容:

So in your item command event you want the following:

if (e.commandname == "yourcommandname")
{
    // do your stuff that needs to be done
    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "key", " $('#myModal').modal(options);", true);
}

这篇关于与LinkBut​​ton的打开弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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