0


How can Edit SqlDataSource record without FormView?
I knows getting data into TextBox, But can't save changes.

protected void Page_Load(object sender, EventArgs e)
{

   DataView dvSql = (DataView)EmployData.Select(DataSourceSelectArguments.Empty);
   foreach (DataRowView drvSql in dvSql)
   {
     E_ID.Text = drvSql["ID"].ToString();
     E_LName.Text = drvSql["LName"].ToString();
     ...
    }
}

protected void SaveChanges_Click(object sender, EventArgs e)
{
    EmployData.UpdateParameters.Add("ID", E_ID);
    EmployData.UpdateParameters.Add("LName", E_LName);
    ....

    EmployData.Update();        
 }

Thank's.

2
  • What's the error when you save changes? Commented May 13, 2016 at 18:09
  • No error. I think it save existing textbox text. Commented May 13, 2016 at 19:35

1 Answer 1

0

So simple...

Add on Load_Page before read code:

        if (Page.IsPostBack)
        { }
        else
        {

            DataView dvSql = (DataView)EmployData.Select(DataSourceSelectArguments.Empty);
....
....
}

Good Day.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.