我知道我目前无法直接使用 因为我需要在表格单元格中访问它UserControl 内 DataList 的 EditTemplate 中的表。
也就是说,我需要递归检查控件以获取 ClientID,是否应该完成
客户端:alert(getMyElement('TextBox1').id)
,其中 getMyElement 检查表单的所有元素并返回带有 id 的控件...或者< br>
服务器端:alert('<%=FindElement(dlDataList, "TextBox1").ClientID%>')
其中 FindElement 是一个基本页面函数,用于检查控制具有第二个参数 id 的元素的第一个参数并返回该控制
?
我想客户端会更快吗?
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 the 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?
发布评论
评论(1)
对于这种情况,我总是选择服务器端。否则,您将用每一行遍历整个 DOM - 根据大小,它可能会占用大量内存。服务器端为此几乎不占用任何资源。
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.