`
happmaoo
  • 浏览: 4472442 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

订餐网站4(管理界面->dishes.aspx)

阅读更多

管理菜品的界面

1. 添加菜品通过 table中添加input text box实现

<asp:TableRow runat="server">

<asp:TableCell runat="server">菜品名称</asp:TableCell>

<asp:TableCell runat="server">菜品介绍</asp:TableCell>

<asp:TableCell runat="server">菜品详情</asp:TableCell>

<asp:TableCell runat="server">菜系</asp:TableCell>

<asp:TableCell runat="server">菜品图片路径</asp:TableCell>

</asp:TableRow>

<asp:TableRow runat="server">

<asp:TableCell runat="server"><input type = "text" style ="width: 80%" id="newDishName" runat="server" /></asp:TableCell>

<asp:TableCell runat="server"><input type = "text" style ="width: 80%" id="newDishIntro" runat="server" /></asp:TableCell>

<asp:TableCell runat="server"><input type = "text" style ="width: 80%" id="newDishDetails" runat="server" /></asp:TableCell>

<asp:TableCell runat="server"><input type = "text" style ="width: 80%" id="newDishType" runat="server" /></asp:TableCell>

<asp:TableCell runat="server"><input type = "text" style ="width: 80%" id="newDishPic" runat="server" /></asp:TableCell>

</asp:TableRow>

2. 下面的展现通过bind gridview实现

3. 实现后效果

4.cs文件

using System;

using System.Collections.Generic;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

using System.Reflection;

using System.Data;

using Common;

public partial class Admin_dishes : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

DataTable dt = dbOperation.GetAllDishes2();

this.GridViewDishes.DataSource = dt;

this.GridViewDishes.DataBind();

}

protected void GridViewDishes_RowEditing(object sender, GridViewEditEventArgs e)

{

this.GridViewDishes.EditIndex = e.NewEditIndex;

this.GridViewDishes.DataBind();

}

protected void GridViewDishes_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)

{

this.GridViewDishes.EditIndex = -1;

this.GridViewDishes.DataBind();

}

protected void GridViewDishes_RowUpdating(object sender, GridViewUpdateEventArgs e)

{

string id = this.GridViewDishes.Rows[e.RowIndex].Cells[0].Text;

string dishName = ((System.Web.UI.WebControls.TextBox)(this.GridViewDishes.Rows[e.RowIndex].Cells[1].Controls[0])).Text;

string intro = ((System.Web.UI.WebControls.TextBox)(this.GridViewDishes.Rows[e.RowIndex].Cells[2].Controls[0])).Text;

string details = ((System.Web.UI.WebControls.TextBox)(this.GridViewDishes.Rows[e.RowIndex].Cells[3].Controls[0])).Text;

string sql = "update dish set dishName ='" + dishName + "',intro ='" + intro + "',details = '" + details + "' where dishId =" + id;

ExcuteSql(sql);

}

protected void GridViewDishes_RowDeleting(object sender, GridViewDeleteEventArgs e)

{

string id = this.GridViewDishes.Rows[e.RowIndex].Cells[0].Text;

string sql = "delete * from dish where dishId =" + id;

ExcuteSql(sql);

}

private void ExcuteSql(string sql)

{

if (dbOperation.ExcuteSql(sql) == -1)

{

Response.Write("<script>alert(\"命令"+sql+"运行失败\")</script>");

}

this.GridViewDishes.EditIndex = -1;

DataTable dt = dbOperation.GetAllDishes2();

this.GridViewDishes.DataSource = dt;

this.GridViewDishes.DataBind();

}

protected void ButtonAdd_Click(object sender, EventArgs e)

{

string dishName = this.newDishName.Value;

string intro = this.newDishIntro.Value;

string details = this.newDishDetails.Value;

string type = this.newDishType.Value;

string pic = this.newDishPic.Value;

string sql = "Insert into dish(dishName,intro,details,type,pic) Values('" + dishName + "','" + intro + "','" + details + "','" + type + "','" + pic + "')";

ExcuteSql(sql);

}

}

分享到:
评论

相关推荐

    小学英语名词单复数练习题带答案..doc

    - dish -&gt; dishes - radio -&gt; radios - photo -&gt; photos - piano -&gt; pianos - knife -&gt; knives - leaf -&gt; leaves - life -&gt; lives - thief -&gt; thieves - man -&gt; men - woman -&gt; women - child -&gt; ...

    小学英语名词单复数练习题带答案.doc

    dish -&gt; dishes, radio -&gt; radios, photo -&gt; photos, piano -&gt; pianos, knife -&gt; knives, leaf -&gt; leaves, life -&gt; lives, thief -&gt; thieves, man -&gt; men, woman -&gt; women, child -&gt; children, foot -&gt; feet, this ...

    小学英语语法习题集.doc

    - dish -&gt; dishes - half -&gt; halves - deer -&gt; deer (单复数同形) - child -&gt; children - fish -&gt; fish (单复数同形) 6. **名词的复数形式变回单数形式**: - wolves -&gt; wolf - doctors -&gt; doctor - cities...

    完美版资料小学英语名词变复数及所有格练习题.doc

    - 以s, x, ch, sh结尾的词加-es,如:box -&gt; boxes, fox -&gt; foxes, dish -&gt; dishes。 - 以辅音字母+y结尾的词,y变i再加-es,如:city -&gt; cities, baby -&gt; babies, fly -&gt; flies。 - 以o结尾的词,一般加-s,但有...

    英语名词单复数练习题带答案.doc

    - 以s, x, ch, sh结尾的名词加-es,如:dish -&gt; dishes, fox -&gt; foxes, branch -&gt; branches。 - 以o结尾的名词,有生命的加-es,无生命的加-s,如:mouse -&gt; mice, photo -&gt; photos, piano -&gt; pianos。 - 不规则...

    PEP小学英语四种时态练习题及答案之欧阳学创编.pdf

    - She is **doing** the dishes. - My brother is **making** kites. - My father is **reading** a new book. 以上是针对“PEP小学英语四种时态练习题及答案之欧阳学创编.pdf”中的部分内容进行的详细解析。...

    初中英语之名词变复数PPT学习教案.pptx

    2. **以s, x, ch, sh结尾的名词**:在词尾加-es,如:box -&gt; boxes, bus -&gt; buses, watch -&gt; watches, dish -&gt; dishes。 3. **以辅音字母+y结尾的名词**:改y为i再加-es,例如:baby -&gt; babies, city -&gt; cities。 ...

    小升初英语语法知识点总结.doc

    小升初英语语法是孩子们从小学过渡到初中的...Peach -&gt; peaches, sandwich -&gt; sandwiches, dish -&gt; dishes, bus -&gt; buses Man -&gt; men, woman -&gt; women 通过反复练习,孩子们可以逐渐掌握并熟练运用这些英语语法知识。

    新冀教版六年级第一学期英语期末试卷(6)精选.doc

    5. dishes(单数)- dish 6. put(现在分词)- putting 7. open(反义词)- close 8. give(过去式)- gave 9. first(原形)- first(保持不变) 10. tomato(复数)- tomatoes 11. people(复数)- people(保持...

    优秀资料(2021-2022年收藏)小学英语语法大全(1).doc

    dish -&gt; dishes bus -&gt; buses man -&gt; men woman -&gt; women 接着,我们进入一般现在时的学习。一般现在时主要用来描述事物的特征、状态,表示经常性或习惯性的动作,以及表达客观事实。 构成上,一般现在时有以下两...

    新版闽教版六年级上Unit5 housework练习题精选.doc

    2. Tom is helping his mom wash the dishes in the kitchen. - 汤姆正在厨房帮妈妈洗碗。 3. Lucy is watering the plants, making sure they grow healthy. - 露西正在给植物浇水,确保它们健康生长。 4. Ben is ...

    五年级上册各单元重点.doc

    4. sit down - 坐下 5. be late - 迟到 6. play computer games - 玩电脑游戏 7. get up - 起床 8. go to school - 上学 9. go to bed - 睡觉 10. make the bed - 整理床铺 11. sweep the floor - 扫地 12. do the ...

    小升初英语知识点归纳总结.doc

    dish: dish -&gt; dishes bus: bus -&gt; buses man: man -&gt; men woman: woman -&gt; women **一般现在时**是英语中最基本的时态之一,它用来表达: 1. **经常性或习惯性的动作**,如"I get up at six every day."(我每天...

    基于Java的外卖点餐网站java+springboot+mysql+vue开发的外卖点餐系统、订餐平台 - 毕业设计.zip

    MySQL是一个关系型数据库管理系统,被广泛用于在线应用,因其高性能、稳定性及开源特性而备受青睐。在这个外卖点餐系统中,MySQL用于存储用户信息、菜品数据、订单记录等关键信息。 2.1 数据库设计 - 用户表(users...

    2016年辽宁学士学位英语考试题答案-、大纲.doc

    6. 对于他人对食物的赞美,答句B "I’m glad you like the dishes" 表达了主人的欣慰和欢迎再次光临的意思。 7. 在求职场景中,职员确认信息并询问应聘者兴趣,选项B "Yes, we are." 表明职位确实在招聘中。 8. 这...

    小学英语时态专项训练.doc

    1. 写出动词的现在分词形式:go -&gt; going, ride -&gt; riding, draw -&gt; drawing, play -&gt; playing, sit -&gt; sitting, collect -&gt; collecting, swim -&gt; swimming, sweep -&gt; sweeping, run -&gt; running, have -&gt; having, ...

    (中小学教育)中考英语语法专项复习1.ppt

    - 一连串过去动作(如:She cooked dinner, washed the dishes, and then watched TV.) - 时间或条件状语从句中的过去将来(如:If it rained, we would stay at home.) - 构成:主语+动词过去式 3. 一般将来...

    五年级英语下册第四单元现在进行时练习题精选.doc

    5. I am doing the dishes. —— 此句正确。 6. My mother is answer the phone. —— 应改为:My mother is answering the phone. 这份练习题旨在通过不同的题型,帮助学生全面理解和掌握现在进行时的用法,包括...

    八年级英语下册:Unit3-Could-you-please-clean-your-room教案.doc

    1. 学习并掌握与家务相关的词汇,如:do the dishes(洗碗)、make the bed(铺床)、take out the rubbish(倒垃圾)、fold the clothes(叠衣服)、sweep the floor(扫地)和clean the living room(打扫客厅)等...

    八年级下册英语教案Unit3-SectionA-知识精讲.doc

    4. **Can you do the dishes?** 这个句子询问对方是否能帮忙洗碗。"do the dishes"是固定搭配,表示洗餐具。类似的结构还有"do some + 动词-ing",如"do some cooking"(做饭)。 5. **Could I at least finish ...

Global site tag (gtag.js) - Google Analytics