C# Target=“_blank” in a LinkButton

前端 未结 8 1376
无人及你
无人及你 2020-12-06 00:58

is it possible to have a target=\"_blank\" in LinkButton...mine doesnt seem to be working



        
8条回答
  •  醉话见心
    2020-12-06 01:48

    A LinkButton in ASP.NET web forms just submits the underlying form using JavaScript so the target="_blank" doesn't actually do anything. To open a new window you can instead modify the target property of the "form" via JavaScript using the LinkButton's OnClientClick event. You also need to undo the modification after the click (using a setTimeout) otherwise further button clicks will unintentionally target a new tab.

    
    

提交回复
热议问题