首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

怎么更改WebPart中partstyle默认的:style="padding:5px"

2012-03-23 
如何更改WebPart中partstyle默认的:stylepadding:5px?在webpart里面,我并没有定义partstyle的任何paddi

如何更改WebPart中partstyle默认的:style="padding:5px"?
在webpart里面,我并没有定义partstyle的任何padding= "5 "值,可为什么他会自动生成style= "padding:5px; "呢:
  <td   class= "WebPartStyle "   cellspacing= "0 "   cellpadding= "0 "  
style= "border-collapse:collapse;padding:5px; ">
<table   cellpadding= "0 "   cellspacing= "0 ">
我设置了 <asp:WebPartZone   Padding= "0 ">   ,还是没有用,而 <PartStyle/> 中又没有padding属性.请问大家在哪里设置,可以把padding设为0px;?

/*----------------------------*/
在.CSS文件中,是这样定义的:
.WebPartStyle
{
  text-align:left;   width:250px;   padding:0px;
  }

/*----------------------------*/
在default.aspx中是这样定义的:
<asp:WebPartZone   ID= "WebPartZone1 "   title   runat= "server "   BorderWidth= "0px "  
HeaderText= " "   Padding= "0 ">
        <PartTitleStyle   CssClass= "WebPartTitle "   />
        <PartStyle   CellSpacing= "0 "   CellPadding= "0 "   CssClass= "WebPartStyle "/>
        <ZoneTemplate>
        <uc2:themectrl   ID= "Themectrl1 "   runat= "server "   Title= "   "   />
        </ZoneTemplate>
        </asp:WebPartZone>

/*----------------------------*/
在ctrpanel\themectrl.ascx中是这样定义的.
<%@   Control   Language= "C# "   AutoEventWireup= "true "  
CodeFile= "themectrl.ascx.cs "   Inherits= "ctrpanel_themectrl "   %>
<table   cellpadding= "0 "   cellspacing= "0 ">
        <tr>
                <td   class= "tabletop "> 主题 </td>
        </tr>
        <tr>
                <td   class= "tablect ">
                        <table   cellpadding= "0 "   cellspacing= "10 ">
                                <tr> <td>
                                        <a   href= "# "> 选择 </a>
                                </td> </tr>
                        </table>
                </td>
        </tr>
        <tr>
                <td   class= "tablebtm "> </td>
        </tr>
</table>

/*----------------------------*/
在生成的HTML代码如下:
<table   cellspacing= "0 "   cellpadding= "0 "   border= "0 "  


id= "ctl00_ContentPlaceHolder1_WebPartZone1 "   title= " ">
  <tr>
    <td   style= "height:100%; "> <table   cellspacing= "0 "   cellpadding= "0 "   border= "0 "  
style= "width:100%;height:100%; ">
      <tr>
        <td> <table   class= "ctl00_ContentPlaceHolder1_WebPartZone1_0 "  
cellspacing= "0 "   cellpadding= "2 "   border= "0 "   id= "WebPart_gwpThemectrl1 "  
style= "width:100%; ">
          <tr>
            <td   class= "WebPartTitle  
ctl00_ContentPlaceHolder1_WebPartZone1_1 "> <table   cellspacing= "0 "  
cellpadding= "0 "   border= "0 "   style= "width:100%; ">
              <tr>
                <td   id= "WebPartTitle_gwpThemectrl1 "  
style= "width:100%;white-space:nowrap; "> <span   title= "     [2] ">  
[2] </span> &nbsp; </td> <td   style= "white-space:nowrap; "> <span  
id= "WebPart_gwpThemectrl1Verbs "  
style= "cursor:hand;display:inline-block;padding:1px;text-decoration:none; "> <span  
id= "WebPart_gwpThemectrl1VerbsPopup "  
style= "font-family:Marlett;font-size:8pt; "> u </span> </span> <div  
id= "WebPart_gwpThemectrl1VerbsMenu "   style= "display:none; ">
                  <table   cellspacing= "0 "   cellpadding= "1 "  
style= "border-collapse:collapse;width:100%; ">
                    <tr>
                      <td   style= "white-space:nowrap; "> <div>
                        <a   title= "最小化“     [2]” "   href= "javascript:void(0) "  
onclick= "document.body.__wpm.SubmitPage( 'ctl00$ContentPlaceHolder1$WebPartZone1 ',  
'minimize:gwpThemectrl1 '); "   class= "menuItem "> <img  
src= "/seaerblog/WebResource.axd?d=Y5zPHA-xVj9CMvZUp4CwGQ2&amp;t=633197904693125000 "  
alt= "最小化“     [2]” "   width= "16 "   height= "16 "  
style= "border-style:none;vertical-align:middle; "   /> &nbsp;最小化&nbsp; </a>
                      </div> <div>
                        <a   title= "关闭“     [2]” "   href= "javascript:void(0) "  
onclick= "document.body.__wpm.SubmitPage( 'ctl00$ContentPlaceHolder1$WebPartZone1 ',  
'close:gwpThemectrl1 '); "   class= "menuItem "> <img  
src= "/seaerblog/WebResource.axd?d=Y5zPHA-xVj9CMvZUp4CwGQ2&amp;t=633197904693125000 "  
alt= "关闭“     [2]” "   width= "16 "   height= "16 "  


style= "border-style:none;vertical-align:middle; "   /> &nbsp;关闭&nbsp; </a>
                      </div> </td>
                    </tr>
                  </table>
                </div> </td>
              </tr>
            </table> </td>
          </tr> <tr>
            <td   class= "WebPartStyle "   cellspacing= "0 "   cellpadding= "0 "  
style= "border-collapse:collapse;padding:5px; ">
<table   cellpadding= "0 "   cellspacing= "0 ">
        <tr>
                <td   class= "tabletop "> 主题 </td>
        </tr>
        <tr>
                <td   class= "tablect ">
                        <table   cellpadding= "0 "   cellspacing= "10 ">
                                <tr> <td>
                                        <a   href= "# "> 选择 </a>
                                </td> </tr>
                        </table>
                </td>
        </tr>
        <tr>
                <td   class= "tablebtm "> </td>
        </tr>
</table> </td>
          </tr>
        </table> </td>
      </tr>
</table>
/*----------------------------*/

[解决办法]
try:

.WebPartStyle
{
text-align:left; width:250px; padding:0px !important;
}

热点排行