gridview中的Html5按钮标记 [英] Html5 button tag in gridview
本文介绍了gridview中的Html5按钮标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在gridview项目模板中使用html5按钮标记。但是我点击按钮时没有任何事件/重定向都不起作用(服务器和客户端)。
Hi, I want to use a html5 button tag in the gridview item template. But none of the events/redirection that I write onclick of the button doesn''t work (Both server & client).
<asp:TemplateField>
<ItemTemplate>
<div class="buttons"> <!-- onEditClick('<%#Eval("TemplateId") %>','<%#Request.QueryString["UserName"] %>') -->
<button id="btnEditTemplate" class="positive" onclick="window.location.href='TemplateEdit.aspx?TemplateId=0'" >
<img src="./styles/ico_edit.png" alt=""/>
Edit
</button>
</div>
</ItemTemplate>
</asp:TemplateField>
如果发生服务器端事件,则我需要在gridview命令中单击该按钮的实例,以便单击相应的行。
任何帮助都将非常感激。
In case of a server side event, then I need to get the instance of that button clicked in the gridview command, to get appropriate row clicked.
Any help would be much appreciated.
推荐答案
尝试:
Try:
onclick="buttonClick('0')"
function buttonClick(tID)
{
window.location.href='TemplateEdit.aspx?TemplateId='+tID;
return false;
}
非常感谢Sandeep,我已经设法解决了这个问题。 javascript期待location.href中的完整URL。非常感谢您的时间,非常感谢。
Ram
Thanks a lot Sandeep, I have managed to fix it. The javascript is expecting the complete url in the location.href. Many thanks for your time, much appreciated.
Ram
这篇关于gridview中的Html5按钮标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文