一、设计后台管理中的新闻管理页面 1 、要求和主页风格统一; 2 、要求此页面实现已存在新闻的修改功能; 3 、要求此页面实现已存在新闻的删除功能; 4 、将网站压缩上交到 ftp 的第 14 周文件下。提示资料: 新闻管理部分的效果图如下: 功能实现提示: 1 、数据库连接设置 SqlConnection myconn = (); DataSet myset = new DataSet (); 2、页面加载 protected void Page_Load( object sender, EventArgs e) { if (!IsPostBack) { typeBind(); newsBind(); }}3、在修改新闻的部分进行了类型的绑定 private void typeBind()// 进行类型的绑定{ string aa= "select typename from newstype" ; SqlDataAdapter sda = new SqlDataAdapter (); = new mand (aa, myconn); DataSet ds= new DataSet (); (ds); this . = ds; //绑定 dripdownlist this . = "typename" ; this . = "typename" ; this .(); }4、在 GridView 控件中显示新闻信息 private void newsBind()// 显示新闻信息{ string selectstr = "select * from information" ; SqlDataAdapter myada = new SqlDataAdapter (selectstr, myconn); (myset, "information" ); = [ "information" ]; (); } 5、添加 GridView 控件的 SelectedIndexChanged 事件: protected void gv_SelectedIndexChanged( object sender, EventArgs e) { int aa= Convert .ToInt32( this .[0].Text); ViewState[ "adid" ]=aa; }6、为“编辑”按钮添加 Click 事件 protected void Button1_Click( object sender, EventArgs e) { if( Convert .ToInt32(ViewState[ "adid" ]) == 0) { ( "<script>alert(' 你还没有选择要更新的数据! ');</script>" ); } else { (); int aa=
新闻管理页面 来自淘豆网m.daumloan.com转载请标明出处.