Last post Jan 31, 2012 11:00 AM by dilip0165
Aug 29, 2008 11:41 AM|Balyk|LINK
ASP.NET Dynamic Data
Sep 02, 2008 08:10 PM|scothu|LINK
You can see a sample of using stored procedures with Linq to SQL and Dynamic Data at our samples page:
In this example the Contact table is driven by stored procedures. Here are the basic steps:
1) Create a Insert, Delete and Update stored procedure. The drag them into the Linq to SQL designer.
2) Click on the entity you want to associate the stored procedures to, in the property window (F4) there will be Insert, Update and Delete options you can select. Select each and associate them to your stored procedures from step 1.
3) For the List page you want to override create a directory based on the table name in the DynamicData\CustomPages directory, drag the List.aspx from the DynamicData\PageTemplates into this directory.
4) Write a stored procedure that does all the operations you want to support. To fully support Dynamic Data it should do paging, sorting and filtering (if their are any foreign key tables). You will need to manually add this stored procedure to the generated
Linq to SQL datacontext using a partial class.
5) In the List.aspx you will need to override the OnSelecting event from the LinqDataSource and call the stored procedure from setp 4 passing the paging, sorting and filter options.
The sample I've provided does all of these steps for the Contact table. The Linq to SQL model has references to the Insert and Delete stored procedures. The Contact entity in the Linq to SQL model has the stored procedures associated with the Insert, Update
and Delete operations, there is a custom page for the Contact List.aspx. it has an override of the OnSelecting event that calls the Get stored procedure passing the appropriate parameters and the data context is extended in a partial class to contain the call
for the Get stored procedure.
This is alot of work but if you are used to using stored procedures these are the same things you would do outside of Linq to SQL.
Jan 31, 2012 11:00 AM|dilip0165|LINK
Hi here I have decsribe how to create a dynamic page using procedure.
it is very useful to make a dynamic page by just using a stored procedure.
in above link i have made a dynamic procedure which is very easy to perform .