开发者

Multiple Common User Control but one .js file

开发者 https://www.devze.com 2023-02-07 11:04 出处:网络
I have include a JS file in to a aspx page. The host page has multiple instances of the user control. and each user control has there own grid. i have defined a

I have include a JS file in to a aspx page. The host page has multiple instances of the user control. and each user control has there own grid. i have defined a Javascript variable in each UserControl to get the UserControl Spcific Grid. The JS file has miltiple common function written for Gri开发者_运维知识库d. but i have a problem to access the User Control specific grid, Is there a way to access user control specific grid?


Instead of register a javascript variable, in the ascx, call functions in this way:

<script>
  doSomethingWithGrid('<%= MyGrid.ClientID %>');
</script>


Asp.NET is changing control id's in run time and this is makes difficult to acces in client (javascript). You can get client like ControlName.ClientID

0

精彩评论

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