开发者

Question about changing IDs with user control and master page

In my user control I got this inline CSS in which I have only css classes... like I am not setting any attribute or whatever on some ID..got only classes like :-

.sp
{
backgrond-image :url(blah blah);
}

and so on..

nothing of the sort

#id1
{
/* set some property here*/
}

Now my question:-

Do I need to worry about system generated IDs if the CSS in my user control got only classes ? like in my page source..the divs ID changes from their original ID to something like ctl00_ContentPlaceHolder2_ctl00_Banner_divBanner after adding 开发者_运维技巧usercontrol and master page ...

so changing IDs shouldn't make any difference..right ??


Webforms, prior to .NET 4.0 all had auto-generated ID's. It was never a good idea to reference an ID as a CSS selector. With .NET 4.0 you have the ability to not auto-generate the ID's and use your normal "nice" ID's.

I would recommend sticking with class selectors, as most controls offer classname as a property.

Good article on the new .NET client ID's.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜