1,在DataGrid中顯示圖片
2,發送郵件
<%@ Import Namespace="System.Web.Mail" %>
public void Mail_Send(object sender, EventArgs e)
{
MailMessage MyMsg = new MailMessage();
MyMsg.From = "";
MyMsg.To = "";
MyMsg.Subject = "test";
MyMsg.Body = "test
";
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{
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;
}
}
阅读(712) | 评论(0) | 转发(0) |