关于gridview问题,希望能帮我,谢谢大家!
前台页面中GRIDVIEW是如下,
<asp:GridView ID= "gvcsdj " runat= "server " AutoGenerateColumns= "False " EmptyDataText= "没有符合条件的信息 " Width= "700px ">
<Columns>
<asp:BoundField DataField= "bh " HeaderText= "胎婴儿编号 " />
<asp:BoundField />
<asp:BoundField DataField= "fq_xm " HeaderText= "父亲姓名 " />
<asp:BoundField DataField= "mq_xm " HeaderText= "母亲姓名 " />
<asp:BoundField DataField= "et_csrq " HeaderText= "出生日期 " />
<asp:BoundField DataField= "et_csdd " HeaderText= "出生地点 " />
<asp:ButtonField Text= "删除 " />
</Columns>
</asp:GridView>
后台想实现功能是:
点击"增加",我不想直接把数据插入数据库,而是想写如内存,同时要把数据在gridview中显示,显示在gridview的数据可以修改,删除,
我把现在代码贴出来,大家看看有什么问题哈~!
后台代码:
DataSet ds = new DataSet();
DataTable dt = ds.Tables[0];
DataRow dr = dt.NewRow();
dr[ "bh "]= "dfdfdf "; //暂时先添入这些数据
dr[ "fq_xm "] = "dfdfdf ";
dr[ "mq_xm "] = "dfdfdf ";
dr[ "et_csrq "] = "dfdfdf ";
dr[ "et_csdd "] = "dfdfdf ";
dt.Rows.Add(dr);
gvcsdj.DataSource = dt;
gvcsdj.DataBind();
希望你们指点指点哈,最好能给我详细代码,十分感激~!!
------解决方案---------------