To be clear, this.id and <%=chbSaveState.ClientID%> will return the same value in this case. Since you're calling this on an event of chbSaveState, you can just use the easily accessible JS property here, rather than <%=chbSaveState.ClientID%>, which requires the server to return the id which is generated by the server for that control.
发布评论
评论(3)
您正在调用 JS 事件 (
onchange
),而不是服务器事件,因此只需传入this.id
即可。需要明确的是,在这种情况下,
this.id
和<%=chbSaveState.ClientID%>
将返回相同的值。由于您是在chbSaveState
事件上调用此函数,因此您可以在此处使用易于访问的 JS 属性,而不是<%=chbSaveState.ClientID%>
,这要求服务器返回服务器为该控件生成的 id。You're calling a JS event (
onchange
), not a server event, so just pass inthis.id
.To be clear,
this.id
and<%=chbSaveState.ClientID%>
will return the same value in this case. Since you're calling this on an event ofchbSaveState
, you can just use the easily accessible JS property here, rather than<%=chbSaveState.ClientID%>
, which requires the server to return the id which is generated by the server for that control.你可以使用 jQuery 来做到这一点,如下所示:
you could do that using jQuery like this:
我对服务器端控制没有太多经验,但也许:
I don't have much experience with server side controls, but perhaps: