gridview未绑定到数据库 [英] gridview is not bind to database

查看:47
本文介绍了gridview未绑定到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

海,

我想保留gridview详细信息.当我单击恢复"按钮时,网页应该

允许在同一发票编号中输入更多详细信息.

注意:gridview未绑定到数据库.



任何想法.

Hai,

I want to hold the gridview details.when i click resume button the web page should

allow to enter further details in same invoice number.

note : gridview is not bind to database .



any ideas.

推荐答案

Get the grid view count then implement the below code

protected void GridView1_RowCommand
(object sender, GridViewCommandEventArgs e)
{
  if (e.CommandName == "Add")
  {
   string strFirstName = ((TextBox)
   GridView1.FooterRow.FindControl("txtFname")).Text;

   string strLastName =
   ((TextBox)GridView1.FooterRow.FindControl
                         ("txtLname")).Text;

   string strDepartment =
   ((TextBox)GridView1.FooterRow.FindControl
                            ("txtDept")).Text;
   string strLocation = ((TextBox)GridView1.FooterRow.
                          FindControl("txtLoc")).Text;

  SqlDataSource1.InsertParameters["fieldname"].DefaultValue
                                             = strFirstName;
  SqlDataSource1.InsertParameters["fieldname"].DefaultValue
                                             = strLastName;
  SqlDataSource1.InsertParameters["fieldname"].DefaultValue
                                             = strDepartment;
  SqlDataSource1.InsertParameters["fieldname"].DefaultValue
                                            = strLocation;<b></b>
  SqlDataSource1.Insert();
  }
}


这篇关于gridview未绑定到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆