转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 站长学院 >> Web开发 >> 正文
ASP.NET简单整理收藏(1)         ★★★★

ASP.NET简单整理收藏(1)

作者:闵涛 文章来源:闵涛的学习笔记 点击数:1944 更新时间:2009/4/23 10:39:15
D noWrap>
<asp:dropdownlist id="DropDownList1" runat="server" Width="48px" AutoPostBack="True"></asp:dropdownlist>
</TD>
<TD noWrap width="5"></TD>
<TD noWrap>
<asp:label id="Label3" runat="server" ForeColor="White" Width="15px">页</asp:label>
</TD>
<TD noWrap width="5"></TD>
<TD noWrap>
</TD>
</TR>
</TABLE>
//传参
private void DataGrid1_ItemDataBound_4(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
 //特效
 if(e.Item.ItemIndex!=-1)
 {
  int orderid=e.Item.ItemIndex+1;
  e.Item.Cells[0].Text=orderid.ToString();    

e.Item.Attributes.Add("onmouseover","this.setAttribute(''''BKC'''',this.style.backgroundColor);this.style.backgroundColor=''''#3a6ea5''''

");
  e.Item.Attributes .Add("onmouseout","this.style.backgroundColor=this.getAttribute(''''BKC'''');");
  if(e.Item.ItemType==ListItemType.AlternatingItem||e.Item.ItemType==ListItemType.Item)
  {
  //弹出一个完整的IE窗口   

e.Item.Attributes.Add("onclick","window.open(''''message.aspx?actid="+e.Item.Cells[1].Text+"'''');");    

//e.Item.Attributes.Add("onclick","window.open(''''detail.aspx?ID="+e.Item.Cells[1].Text+"'''',''''newwin'''',''''width=750,height=600,scrol

lbars=yes,top=50,left=50'''');");
  }
 }
}
Response.Write("<script>window.open(''''excel.aspx'''',''''_blank'''');</" + "script>");
this.linkdb();
//
string sql="select * from VIEW_USRACT WHERE ACTID=''''"+Session["strmta"].ToString()+"''''";
SqlCommand cmd=new SqlCommand(sql,conn);
try
{
 SqlDataReader dr=cmd.ExecuteReader();
 if(dr.Read())
 {  
  this.ACTIDtext.Text=dr[0].ToString();
  this.USRNAMEtext.Text=dr[1].ToString();
 }
}
//添加
sql="insert into ContList()

values(''''"+this.txtactid.Text.Trim()+"'''',''''"+count.ToString()+"'''',''''"+this.txtCName.Text.Trim()+"'''',''''"+this.txtCRank.Text.Trim()+"''''

,''''"+this.txtCphone1.Text.Trim()+"'''',''''"+this.txtCphone2.Text.Trim()+"'''',''''"+this.txtHdPhone.Text.Trim()+"'''',''''"+this.txtHmPhone.Tex

t.Trim()+"'''',''''"+this.txtContBP.Text.Trim()+"'''',''''"+this.txtCmemo.Text.Trim()+"'''',''''"+sqlstr+"'''')";
SqlCommand  myCommand=new SqlCommand(sql,conn);
myCommand.ExecuteNonQuery();
//修改
string sql1="";
sql1="update ContList set RouteID=''''"+sqlstr+"'''' where ActID=''''"+this.txtactid.Text.Trim()+"''''";
SqlCommand  cmd=new SqlCommand(sql1,conn);
cmd.ExecuteNonQuery();
//调用存储过程
SqlCommand cmd1=new SqlCommand("PRO_PLANALME",conn);
cmd1.CommandType = CommandType.StoredProcedure; 
cmd1.Parameters.Add("@aa",this.txtactid.Text.Trim());
cmd1.ExecuteNonQuery();
//
if(this.Page.IsValid)
{
 try
 {
  this.Response.Write("<script>alert(''''添加成功'''');</script>");
 }
 catch(Exception E)
 {
  this.Response.Write(E.ToString());
  this.Response.Write("<script>alert(''''添加不成功'''');</script>");
 }
 finally
 {
  conn.Close();
 }
}
else
{
 this.Response.Write("<script>alert(''''修改不成功'''');</script>");
}
 
private void CustomValidator1_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)
{//姓名(txtCName)
 try
 {
  int byteCount=System.Text.Encoding.Default.GetByteCount(this.txtCName.Text.Trim());
  if(byteCount>10)
  {
   args.IsValid=false;
   return;
  }
 }
 catch(Exception)
 {
 }
 args.IsValid=true;
}
//修改               

UPDATE ContList set CName=@CName WHERE (ContID=@ContID AND ActID=@ActID)"; 
SqlCommand cmd=new SqlCommand(sql,conn);
cmd.Parameters.Add(new SqlParameter("@ActID",SqlDbType.VarChar));
cmd.Parameters["@ActID"].Value="000004";
//序号
cmd.Parameters.Add(new SqlParameter("@ContID",SqlDbType.VarChar));
cmd.Parameters["@ContID"].Value=this.Request.Params["ContID"].ToString();
cmd.ExecuteNonQuery();

//删除
this.Response.Write("<script language=''''javascript''''>");
this.Response.Write("aa=window.confirm(''''您确定要删除联系人'''');");
this.Response.Write("if(aa==false){");
this.Response.Write("window.location.href=''''contlist.aspx''''");
this.Response.Write("}");
this.Response.Write("if(aa==true)");
this.Response.Write("{");
this.Response.Write("window.location.href=''''del_cont.aspx''''");
this.Response.Write(" } "); 
this.Response.Write("</script>");

string sql="";
sql="delete from ContList where ContID=''''"+this.Session["ContID"].ToString()+"'''' AND ActID=''''000004''''";
SqlCommand  cmd=new SqlCommand(sql,conn);
SqlCommand cmd1=new SqlCommand("PRO_PLANALMEVT_INTOPLANALMEVTGET",conn);
cmd1.CommandType = CommandType.StoredProcedure; 
cmd1.Parameters.Add("@ACTID","000004"); 
cmd.ExecuteNonQuery();
cmd1.ExecuteNonQuery();
this.Response.Write("<script>alert(''''删除成功'''')</script>");       

this.Response.Write("<script>window.location.href=''''contlist.aspx''''</script>");

//打印

<style>
 BODY { SCROLLBAR-BASE-COLOR: #99ccff }
</style>
<style media="print">
.Noprint { DISPLAY: none }
UNKNOWN { PAGE-BREAK-AFTER: always }
</style>
<style>
.style_td { BORDER-RIGHT: #ffffff 0px solid; BORDER-TOP: #ffffff 0px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM:

#000000 1px solid }
.style_tab { BORDER-RIGHT: #000000 2px solid; BORDER-TOP: #000000 2px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM:

#000000 1px solid }
.NOPRINT { FONT-SIZE: 9pt; FONT-FAMILY: "宋体" }
</style>

<TD align="center"><!--#include file="print.html" --><FONT face="宋体"></FONT></TD>

<center class="Noprint">
<p>
<OBJECT id="WebBrowser" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0" width="0" VIEWASTEXT>
</OBJECT>
<input type="button" value="打印" onclick="document.all.WebBrowser.ExecWB(6,1)"> <input type="button" value="直接打印"

onclick="document.all.WebBrowser.ExecWB(6,6)">
<input type="button" value="页面设置" onclick="document.all.WebBrowser.ExecWB(8,1)">
<input type="button" value="打印预览" onclick="document.all.WebBrowser.ExecWB(7,1)">
</p>
</center>
//取得IP地址
string hostIP=System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName()).AddressList[0].ToString();


上一页  [1] [2] 


[C语言系列]NET 中C#的switch语句的语法  [系统软件]托拽Explore中的文件到VB.net的窗口
[系统软件]Boost库在XP+Visual C++.net中的安装  [常用软件]新配色面板:Paint.Net3.0RC1官方下载
[常用软件]用内建的“Net Meeting”聊天  [VB.NET程序]Henry的VB.NET之旅(三)—共享成员
[VB.NET程序]Henry的VB.NET之旅(二)—构造与析构  [VB.NET程序]Henry的VB.NET之旅(一)—失踪的窗体
[VB.NET程序]在托盘上显示Balloon Tooltip(VB.NET)  [VB.NET程序]Henry手记-VB.NET中动态加载Treeview节点(二)
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · Web开发  · 网页制作
    · 平面设计  · 网站运营
    · 网站推广  · 搜索优化
    · 建站心得  · 站长故事
    · 互联动态
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台