다음을 통해 공유


Reason for the client ID of web part like webpartWPQ7

One of my customer would like to know why OOB web part generate the ID like webpartWPQ1, webPartWPQ2 etc

    1: <table width="100%" cellpadding="0" cellspacing="0" border="0">
    2:  
    3: <tr>
    4:  
    5: <td id="MSOZoneCell_WebPartWPQ7" vAlign="top"><table TOPLEVEL border="0" cellpadding="0" cellspacing="0" width="100%">
    6:  
    7: <tr>
    8:  
    9: <td><table border="0" cellpadding="0" cellspacing="0" width="100%">
   10:  
   11: <tr class="ms-WPHeader">
   12:  
   13: <td title="UserControlWebPart Web Part - UserControlWebPart Description" id="WebPartTitleWPQ7" style="width:100%;">
   14:  
   15: <h3 class="ms-standardheader ms-WPTitle"><nobr><span>UserControlWebPart Web Part</span><span id="WebPartCaptionWPQ7"></span></nobr></h3></td>
   16:  
   17: <td align="right" style="padding-right:2px">
   18:  
   19: <div style="cursor: pointer" class="ms-HoverCellInActive" onmouseout="this.className='ms-HoverCellInActive'" onmouseover="this.className='ms-HoverCellActiveDark'"><nobr><a onclick="MSOWebPartPage_OpenMenu(MSOMenu_WebPartMenu, this, WebPartWPQ7,&#39;False&#39;);return false;" id="WebPartWPQ7_MenuLink" onkeydown="MSOMenu_KeyboardClick(WebPartWPQ7_MenuLink, 13, 40)" href="#">
   20:  
   21: <img src="/_layouts/images/Menu1.gif" border="0" align="absmiddle" title="UserControlWebPart Web Part Web Part Menu" alt="UserControlWebPart Web Part Web Part Menu" style="padding-left:2px;" /></a></nobr></div
   22:  
   23: ></td>
   24:  
   25: </tr>
   26:  
   27: </table>
   28:  

You have inherit you custom web part from “Microsoft.SharePoint.WebPartPages.WebPart” to generate the ID’s (e.g webpartWPQ7).