开发者

search for ClientID client-side or server-side?

I understand that I currently can't use <a onclick="alert('<%=TextBox1.ClientID%>')" directly because I need to access it in a table cell in a table in the EditTemplate of a DataList inside a UserControl.

That said, I need to recursively check the controls to get the ClientID, should it be done

client-side: alert(getMyElement('TextBox1').id), where getMyElement checks all elements of the form and returns the control with th开发者_如何学JAVAe id...or

server-side: alert('<%=FindElement(dlDataList, "TextBox1").ClientID%>') where FindElement is a base page function that checks the controls of the first param for an element with an id of the second param and returns that control ?

I'm figuring the client-side would be faster?


I always go with server side for this case. Otherwise you're traversing the entire DOM with each row - depending on the size, it could be a memory hog. Server side takes almost no resources for this.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜