asp.net要对数据库进行操作,编辑,添加删除,除了用datagrid之外,还可以用其他的控件来操作吗?比如textbox,因为我想一条一条的来编辑这些数据,而不是用datagrid那种表的方式来编辑,在其他的RAD工具中,好象有DBtextbox这样的控件的,我看textbox中只能绑定他的text属性。

解决方案 »

  1.   

    把datagrid里面的数据绑定到textbox然后修改
      

  2.   

    你是根本不打算用DATAGRID的话,
    直接绑定数据给TextBox就得了。
      

  3.   

    将值付给textbox 不就可以了。
      

  4.   

    protected static int nRowsPos;
    protected DataSet ds;
    private string TxtBindData(string fieldName)
    {
    DataSet ds=rule.Employee.selectAll();
    string buf=ds.Tables[0].Rows[nRowsPos]     
                               [fieldName].ToString();
    return buf;
    }  
    private void RefLinkBtn_Click(object sender, System.EventArgs e) //上一条纪录
    {

    if(nRowsPos!=0)
    {
    nRowsPos-=1;
    this.IdTxt.Text=TxtBindData("EmployeeID");
    this.FirstNameTxt.Text=TxtBindData("FirstName");
    this.LastNameTxt.Text=TxtBindData("LastName");
    }
    else
    {
    MyJS.JScript.Alert("已是第一条纪录!");
    }

    }private void NextLinkBtn_Click(object sender, System.EventArgs e) //下一条纪录
    {
    ds=rule.Employee.selectAll();
    if( nRowsPos <ds.Tables[0].Rows.Count-1)
    {
    nRowsPos+=1;

    this.IdTxt.Text=TxtBindData("EmployeeID");
    this.FirstNameTxt.Text=TxtBindData("FirstName");
    this.LastNameTxt.Text=TxtBindData("LastName");
    }
    else
    {
    MyJS.JScript.Alert("已是最后一条纪录!");
    }

    }
    绑定textbox。对数据进行操作。
      

  5.   

    以前爱用DataGrid,但感觉过于烦琐,现在只要有列表需求的,全部用DataList,模版列...
      

  6.   

    我现在用的是formview就可以实现你说的。
      

  7.   

    可以啊,你可以用repeater控件,在itemtemplate中,加一个textbox,绑定repeater时,给textbox赋值,更新时,取这个textbox的值.itemtemplate中,设一个label,设visible=false,并绑定到一个主键,就可以了