I'm just starting out on my first Web Application on VS Express for Web using C#. Have created a Database First Dynamic Data website and have the basics (i.e. can follow simple instructions) but the GridView/DetailsView offering out of the box is not really what I need.
I want to include custom Webforms that will have a smattering of Textboxes, checkboxes, dropdowns etc. dotted around the page. I can not find any samples/tutorials specifically about this and am still grappling with a few of the fundamental concepts hence I have not been able to extrapolate the information I can find and apply it successfully.
Is there a way to bind an Entity Data Source to a Form (or other container) so that some magic code in the click event on a button will save the changes? I think what I need to do is create an Object Context (at page/form/container) level and then use the context.saveChages() method to update the database. Just not sure how to implement this for the following form sample:
<form id="form1" runat="server"> <div> <asp:TextBox ID="Fld_tb_DeviceName" runat="server">This is required</asp:TextBox> <br /> <asp:CheckBox ID="Fld_ch_DeviceVisualChk" runat="server" /> <br /> <asp:TextBox ID="Fld_tb_DriveCap_C" runat="server" /> <br /> <asp:Button ID="Add" runat="server" OnClick="Add_Click" Text="Button" /> ......
The other approach I have an inkling about would be to scour the controls on the page and then use the .Text property of each item and then (parse and) pass these to an update query. At this stage in my journey this approach would seen the easier of the two (although not necessarily achievable in the short term) but was rather hoping to hook into the smarts of EF somehow.
Any help or suggestions (hire a real programmer springs to mind . . . ) would be much appreciated.