产品类的操作
来源:互联网 发布:怎么看淘宝号注册时间 编辑:程序博客网 时间:2024/06/02 11:36
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class ProductClass_Bit_ProductBit : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SessionTF();
InsertRecord();
if (!IsPostBack)
{
Databind_Data();
}
}
private void SessionTF()
{
if (Session["user"] != null)
{
Response.Write("<script language=javascript>window.top.location.href='../index.aspx'</script>");
}
}
private void InsertRecord()
{
DataTable dt = Method.Return_DataTable("select * from bigtype",CommandType.Text);
DropDownList1.DataSource = dt;
DropDownList1.DataTextField = "name";
DropDownList1.DataValueField = "id";
DropDownList1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
Method.ExecuteNonQuery_DataTable("insert type values(@pid,@name,@memo)",CommandType.Text,
new SqlParameter("@pid",DropDownList1.SelectedValue),
new SqlParameter("@name",Product.Text.Trim()),
new SqlParameter("@memo",TextBox1.Text.Trim())
);
Server.Transfer("ProductBit.aspx");
}
private void Databind_Data()
{
GridView1.DataSource = Method.Return_DataTable("select b.id id ,a.name classbig,b.name classbit,b.memo memo from bigtype a join type b on a.id=b.parentid", CommandType.Text);
GridView1.DataBind();
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
Databind_Data(); ;
DataBind();
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
Databind_Data();
}
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
DropDownList drop = GridView1.Rows[e.RowIndex].Cells[1].FindControl("DropDownList2") as DropDownList; //所属大类
TextBox textbox = GridView1.Rows[e.RowIndex].Cells[2].FindControl("txtclassbit") as TextBox; //小类
TextBox memo = GridView1.Rows[e.RowIndex].Cells[3].FindControl("TextBox2") as TextBox; //memo
Label label = GridView1.Rows[e.RowIndex].Cells[0].FindControl("Label3") as Label;
if (textbox != null && drop != null && memo != null)
{
Method.ExecuteNonQuery_DataTable("update type set parentid=@pid,name=@name,memo=@memo where id=@id", CommandType.Text,
new SqlParameter("@pid", drop.SelectedValue),
new SqlParameter("@name", textbox.Text.Trim()),
new SqlParameter("@memo", memo.Text.Trim()),
new SqlParameter("@id", label.Text)
);
}
GridView1.EditIndex = -1;
Databind_Data();
}
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
Label label = GridView1.Rows[e.RowIndex].Cells[0].FindControl("Label2") as Label;
if (label==null)
{
return;
}
Method.ExecuteNonQuery_DataTable("delete from type where id=@id",CommandType.Text,new SqlParameter("@id",label.Text.Trim()));
ClientScript.RegisterClientScriptBlock(GetType(),"aaa","<script>alert('删除成功!')</script>");
Databind_Data();
}
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
Databind_Data();
}
protected void Button2_Click(object sender, EventArgs e)
{
}
}
- 产品类的操作
- 产品类的经验分享
- 一个女性产品类的Magento模板
- 产品类研发项目需要注意的几个问题
- IT产品类企业网站设计方案
- IT产品类企业网站设计方案
- 腾讯产品类实习生应聘记
- 应用产品类业务--测试总结
- C#设计模式之工厂模式(Factory)--04 抽象工厂模式中访问具体产品类的属性
- 网易互联网产品类笔试题(数据挖掘岗位)
- 产品类面试体验(网易腾讯UC)
- 工厂模式-简单工厂模式-省略抽象产品类
- 转:大众点评网产品类 校招题目解析
- 58同城产品类笔试题目_20131030
- 关于滴滴出行产品类实习三个面试
- linux 的常用操作 杀进程 产看日志
- 腾讯实习面试经历——产品类止步专业一面
- 数值分析类智力题(IT产品类笔面试题型真题分析)
- DirectShow SDK安装以及在vs2010上的配置
- poj 1511 spfa
- PCC(Pulse count control)编程之二:循环计数
- 求fst的模板程序
- 用js获取input输入的值以及Button按钮
- 产品类的操作
- css
- Linux C 动态内存分配 malloc及相关内容
- poj 1308 并查集判断“树”
- Hadoop 伪分布式下更换默认hadoop.tmp.dir路径
- Linux下使用USB转串口读GPS数据
- Winpcap常用函数解析
- 在vs2005中为listbox加上水平滚动条
- 【收集】易语言界面学习推荐地址(以后继续更新)