Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 软件时空 > 软件相关 > 一些使用技巧
【标  题】:一些使用技巧
【关键字】:
【来  源】:http://www.cublog.cn/u/674/showart.php?id=112394

一些使用技巧

Your Ad Here
1,在DataGrid中顯示圖片
<ItemTemplate >                
        <img src='<%# "
/web/file/"+DataBinder.Eval(Container,"DataItem.圖片") %>' Height="80px" Width="80px"  />
</ItemTemplate>

2,發送郵件
<%@ Import Namespace="System.Web.Mail" %>
 public void Mail_Send(object sender, EventArgs e)
    {
   
        MailMessage MyMsg = new MailMessage();
        MyMsg.From = "
xw@tkl.tsannkuen.com";
        MyMsg.To = "
xw_liu@tkl.tsannkuen.com";
        MyMsg.Subject = "test";
        MyMsg.Body = "<html><body><font color=red><strong>test</strong></body></html>";
        MyMsg.BodyFormat = MailFormat.Html;
        try
        {
            SmtpMail.Send(MyMsg);
            Response.Write("發送成功");
           
        }
        catch
        {
            Response.Write("發送失敗");
        }
    }

3,在DataGrid里的自動排序
 protected void dgFunc_ItemDataBound(object sender, DataGridItemEventArgs e)
    {
        string strID = Convert.ToString(e.Item.ItemIndex + 1);
        if (strID == "0")
        {
        }
        else
        {
            e.Item.Cells[0].Text = strID;
        }
    }

3,DropDownList綁定兩個字段
select a + b as c from table
DropDownList.DataTextField = "c";

4,DropDownList綁定
 ListItem li;
        li = ddlDeptEnt.Items.FindByValue("1005");
        if (li != null)
            li.Selected = true;

5,CheckBoxList綁定
for(int j=0;j<Checkboxlist1.Items.Count;j++)
{
      if(temp.IndexOf(Checkboxlist1.Items[j].Value)!=-1)
    Checkboxlist1.Items[j].Selected=true;
}

6,這個方法沒用過不知道干什么的
if (dt.Rows.Count > 0)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ListItem li = CheckBoxList1.Items.FindByValue(dt.Rows[i]["blogmenuid"].ToString());
                if (li != null)
                  li.Selected = true;
              }
      }
几個js:【上一篇】
自己的程序自己做:【下一篇】
【相关文章】
没有相关文章
【随机文章】
  • 【转载】Netscreen VS checkpoint 杂谈
  • MFC 笔记 申请设备子类 加入图片 自定义字体 修改窗口标题
  • 喇曼光纤放大器的设计考虑及其实验
  • [译]使用自定义的ASP.NET Build Provider以及编译器技术创建DAL组件
  • 让程序在Windows启动时自动运行
  • 基于MIDP实现ResourceBundle类
  • grub中MD5口令设置
  • scounix下curses编程函数说明
  • 项目中的oracle开发技巧
  • 用mouse对象方法仿双击打开文件
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.