DataGrid Update() method not working

Posts   
 
    
Coderoid
User
Posts: 7
Joined: 03-Apr-2008
# Posted on: 03-Apr-2008 17:24:04   

Hi all,

I have a datagrid on which i select an item and click Edit to go to the edit page. On that page, when i click Save i set the current date as the value of a textbox and call the FormView's update function (the formview is bound to an LLBLGen datasource). This works fine for one page, but the date is not saved for the other page. Why would this be?

Here is the code;

protected void ButtonEdit_Click(object sender, EventArgs e) { //Set today as the updated date ** TextBox textBoxDateUpdated = (TextBox)FormView1.Row.FindControl("TextBoxEditDateUpdated"); textBoxDateUpdated.Text = DateTime.Now.ToString(); FormView1.UpdateItem(true); Controller.Instance.ListAdvertisers(); }**

Thanks,

Lloyd Dube

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 04-Apr-2008 16:07:19   

What's the relation between the DataGrid and the FormView?

Would you please post the aspx declaration code?

Coderoid
User
Posts: 7
Joined: 03-Apr-2008
# Posted on: 08-Apr-2008 10:41:03   

Thanks guys, got it working. I removed the button's event handler and simply set its CommandName property to Insert.