Last post May 21, 2012 05:35 PM by sjnaughton
May 21, 2012 10:53 AM|biga|LINK
I have a dynamic data web site and I need to add some custom behaviour to one of the Edit pages.
I've created a custom page for one of the entities and want to add a button that will execute a Linq to SQL query that updates the database using some values from the Edit page.
As the Edit page was dynamically generated what syntax do I use to access fields from the record being edited on the Edit page in my Linq to SQL query?
May 21, 2012 11:09 AM|sjnaughton|LINK
Hi Biga,getting at the data in the page can be difficult however if you add a custom button to the FormView with a command type of Update/Insert you can then get access to the updated values in the updateing/Inserting event you can test for
protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e)
if (e.CommandArgument == "DoSomething")
var values = e.NewValues;
// do your stuff...
e.Cancel = true;
where "DoSomething" is the command argument that you set so you can differentiate you custom button from the normal Update/Insert button, and then when you are done set e.Cancel to true and the update will abort after doing your custom thing.
May 21, 2012 12:48 PM|biga|LINK
Thanks very much Steve - that works fine.
May 21, 2012 05:35 PM|sjnaughton|LINK
Always welcome :)