I'm developing my custom web part. Code generated by SharePoint is below:
<div id="MSOZoneCell_WebPartctl00_ctl39_TestTile" class="s4-wpcell-plain ms-webpartzone-cell ms-webpart-cell-vertical ms-fullWidth ">
<div class="ms-webpart-chrome ms-webpart-chrome-vertical ms-webpart-chrome-fullWidth ">
<div webpartid="94347657-e02b-4104-8033-26c64532ca77" haspers="false" id="WebPartctl00_ctl39_TestTile" width="100%" class="ms-WPBody noindex " allowdelete="false" allowexport="false" style="">
<div id="ctl00_ctl39_Test" class="cssClassAddedFromCode">
web part content
</div>
</div>
</div>
I would like to add from code cssclass to root div with Id = MSOZoneCell_WebPartctl00_ctl39_TestTile
.
When I try add my class during running method AddAttributesToRender
:
writer.AddAttribute(HtmlTextWriterAttribute.Class, "cssClassAddedFromCode");
The cssclass goes to last div.