using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace LSJ.Web.admin
{
public partial class productslist : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
Bindtype();
this.hidden_1.Value = "0";
this.Bind();
}
}
LSJ.BLL.userinfo user = new LSJ.BLL.userinfo();
LSJ.BLL.product pro = new LSJ.BLL.product();
/// <summary>
/// 绑定书籍类别
/// </summary>
private void Bindtype()
{
LSJ.BLL.type_1 t_1 = new LSJ.BLL.type_1();
DataTable dt_1 = t_1.type_1list("");
foreach (DataRow row in dt_1.Rows)
{
ListItem li = new ListItem(row["typename"].ToString(), row["typeid_1"].ToString());
this.type_1ddl.Items.Add(li);
}
this.type_1ddl.Items.Insert(0, new ListItem("一级类别", "0"));
}
/// <summary>
/// 书籍数据绑定
/// </summary>
private void Bind()
{
string users = " ";
if (user.IsLogin() == true)
{
users = user.getUserName();
}
DataTable table = pro.selectproduct(int.Parse(this.type_1ddl.SelectedValue.ToString()),
int.Parse(this.hidden_1.Value.ToString()), this.productnameTb.Text.Trim(),
int.Parse(this.recommendedddl.SelectedValue.ToString()), 0, users);
this.productlistGv.DataSource = table.DefaultView;
this.productlistGv.DataBind();
}
protected void searchBt_Click(object sender, EventArgs e)
{
//this.type_2ddl.Items.Clear();
//string[] options = this.hidden_2.Value.ToString().Split('#');
//for(int i = 1; i < options.Length; i ++)
//{
// string id = options[i].Split('@')[0];
// string name = options[i].Split('@')[1];
// this.type_2ddl.Items.Add(new ListItem(name,id));
//}
//this.type_2ddl.Items.Insert(0, new ListItem("二级分类", "0"));
//this.hidden_1.Value = this.type_2ddl.SelectedValue.ToString();
//Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('" + this.hidden_2.Value + "')</script>", false);
Bind();
}
protected void productlistGv_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
this.productlistGv.PageIndex = e.NewPageIndex;
this.Bind();
}
protected void productlistGv_RowEditing(object sender, GridViewEditEventArgs e)
{
this.productlistGv.EditIndex = e.NewEditIndex;
this.Bind();
}
protected void productlistGv_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
this.productlistGv.EditIndex = -1;
this.Bind();
}
protected void productlistGv_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
int id = int.Parse(this.productlistGv.DataKeys[e.RowIndex].Value.ToString());
pro.deleteproduct(id);
this.Bind();
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('删除成功!')</script>", false);
}
protected void productlistGv_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
如需定做或者获取更多资料,请联系QQ:375279829