开发者

How to find a button in Gridview and perform click programmatically in ASP.NET?

开发者 https://www.devze.com 2023-03-24 11:42 出处:网络
I am currently learning ASP.NET and I\'ve been wonderin开发者_如何转开发g if is possible to find a button that is in a Gridview and perform a \'Click\' on it when the user clicks on another button not

I am currently learning ASP.NET and I've been wonderin开发者_如何转开发g if is possible to find a button that is in a Gridview and perform a 'Click' on it when the user clicks on another button not in the Gridview.

Thanks, Y_Y


Are you looking to do this client side or server side?

Client side, you could find the GridView button via jQuery:

$('#<% buttonId.ClientID %>').click();

Server side, could you set the GridView's OnClick event to whatever you'd rather have it point to?


You can make a document.getElementByID in a javascript and call the .click() of this button.


You can use GridView.Row.FindControls('controlId')

You can check it on MSDN here.

0

精彩评论

暂无评论...
验证码 换一张
取 消