使元素的ID在ASP.NET的WinForms小? [英] Make element id smaller in ASP.NET Winforms?
问题描述
我有一个ASP.NET的Winform网站。元素Id's往往是长,是这样的:
I have a ASP.NET Winform website. Id´s of the elements are often long, like this :
ctl00_ContentPlaceHolder1_ShowThreads1_repThreads_ctl03_divThreadTitle
大部分id's的仅用于在服务器端所以真的ID发送给客户端没有意义的。
Most of the id´s is only used at server side so there is really no point in sending id to the client.
反正是有来处理这还是我将不得不手动改变我的名字的财产以后这样的:
Is there anyway to handle this or will I have to manually change my names to somthing like this :
ctl00_CPH_ST1_rT_ctl03_dTT
淡然的这将不说太多关于元素,但数据发送到客户端的总金额会减少很多。
This will of couse dont say much about the element but the total amount of data sent to client would be reduced a lot.
推荐答案
使用的 的ClientIDMode
介绍在.NET 4.0中属性。您可能希望静态
,因为这将使它刚刚 divThreadTitle
。
Use the ClientIDMode
property introduced in .NET 4.0. You might want Static
since that will make it just divThreadTitle
.
这篇关于使元素的ID在ASP.NET的WinForms小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!