欢迎光临
我们一直在努力

Web用户空件的属性中自定义属性的设置和使用-ASP教程,ASP应用

建站超值云服务器,限时71元/月

 

public class bull : system.web.ui.usercontrol
{
 private string _strid;// 自定义属性值  mid
 public string imid
 {
  get
  {
   return _strid;
  }
  set
  {
   _strid=value;
  }
 }
 private string _strpagesize;//自定义属性 显示个数
 public string ipagesize
 {
  get
  {
   return _strpagesize;
  }
  set
  {
   _strpagesize=value;
  }
 }
 public string _strlinetitle;//行头
 public string ilinetitle
 {
  get
  {
   return _strlinetitle;
  }
  set
  {
   _strlinetitle=value;
  }
 }
 public string iforecolor
 {
  set
  {
   dltnews.alternatingitemstyle.forecolor=color.fromname(value);
  }
 }
 public string ibackcolor
 {
  set
  {
   dltnews.alternatingitemstyle.backcolor=color.fromname(value);
  }
 }
 protected system.web.ui.webcontrols.datalist dltnews;
 private void page_load(object sender, system.eventargs e)
 {
  if(!page.ispostback)
  {
   new sql.tsqldb().binddatalist(“psp_showbulletininfolist “+ipagesize+”,”+imid,dltnews);
  }
 }
 …
}
前台
<asp:datalist id=”dltnews” runat=”server” width=”185″>
 <itemstyle height=”25px”></itemstyle>
 <itemtemplate>
  <a href=../bulletin/show.aspx?id=<%# databinder.eval(container.dataitem,”dc_id”) %> target=_blank>
   <%=_strlinetitle%><%# databinder.eval(container.dataitem,”vc_title”) %>
   <font class=”zt6″>
    <%# convert.todatetime(databinder.eval(container.dataitem,”dt_date”)).tostring(“[yyyy年mm月dd日]”) %>
   </font></a>
 </itemtemplate>
</asp:datalist>
调用:
<uc1:bull id=”bull1″ runat=”server” imid=”278″ ipagesize=”5″ ilinetitle=”<font color=red>◇</font>” ibackcolor=”#ff0000″>

该例子主要演示了web自定义组件的属性定义、负值和使用。

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » Web用户空件的属性中自定义属性的设置和使用-ASP教程,ASP应用
分享到: 更多 (0)