English 中文(简体)
3. 与触发器具的联系
原标题:href link to trigger asp.net c# button event

我有一个由清单项目组成的航道。 在“ bar条”结束时,我想要有 log子:

//other links

...

<li>
    <a href="#"> logout </a>
</li>

我在C#代码中有一项名为“的示意图-Clickout(目标投放人,活动Args e)的活动,我想在用户点击上述navbar链接,但显然是普通的<代码><a> tags 不会触发ASP。 NET点击事件。

因此,我认为I d为cl,并创设了HIDDEN <asp:Button>称标志,这确实触发了<代码>的行文——Click/code>功能,然后使 Java得以点击 but子。

<a href="javascript:document.getElementById( logout ).click();" class="top">Log Out</a>

<form runat="server">
    <asp:Button ID="logout" runat="server" onclick="Logout_Click" Visible="false" />
</form>

但它依然没有工作。

谁能帮助我?

最佳回答

Can you try without the Visible="false" on the asp:button?

而且,如果它用 c子掩盖它,则作风“显示:无;”

问题回答

Try:

<a href="javascript:document.getElementById( <%= logout.ClientID %> ).click();" class="top">Log Out</a>

我认为,这本书需要客户一方支持你的蚊帐控制:

javascript:document.getElementById( <%=logout.ClientID ).click()

Why not you are using Asp.net LinkButton ? It s easy to do this work with LinkButton.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签