﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebGrid Enterprise - Simple Example using asp:SqlDataSource or Select, Update using sprocs</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Simple-Example-using-aspSqlDataSource-or-Select-Update-using-sprocs/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Simple Example using asp:SqlDataSource or Select, Update using sprocs</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Simple-Example-using-aspSqlDataSource-or-Select-Update-using-sprocs/</link><pubDate>Fri, 30 Sep 2011 03:31:33 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;I modify the &lt;strong&gt;spTestSelect&lt;/strong&gt; stored procedure from following:&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;ALTER PROCEDURE [dbo].[spTestSelect]	
AS
BEGIN
	Select SupplierID, CompanyName, City  FROM Suppliers
END&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;into:&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;ALTER PROCEDURE [dbo].[spTestSelect]
	@City nvarchar(30)
AS
BEGIN
	Select SupplierID, CompanyName, City  FROM Suppliers
	WHERE City=@City
END&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;The new select stored procedure now has a parameter named &lt;strong&gt;City&lt;/strong&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;Next, the SqlDataSource1 control is configured into the following:&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&amp;lt;asp:SqlDataSource ID="SqlDataSource1" runat="server"
    ConnectionString="&amp;lt;%$ ConnectionStrings:SqlNorthwindConnectionString %&amp;gt;"
    SelectCommand="spTestSelect" SelectCommandType="StoredProcedure"&amp;gt;
&amp;lt;/asp:SqlDataSource&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;Please note that the select parameter is not declaratively defined inside the SQLDataSource control because the parameter will be added from code behind as shown in the following code snippet.&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;protected void Page_Load(object sender, EventArgs e)
{
    SqlDataSource1.SelectParameters.Add("City", System.Data.DbType.String, "Frankfurt");
}&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;Sorry for not directly provide you sample with the delete stored procedure, since I have no information about how you implement the hidden bound columns.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;I believe that if the similar scenario for the select command works, the same approach will works for the delete operation.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;Hope this helps.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;*Note: you may modify the sample and send back to us for further investigation.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Simple Example using asp:SqlDataSource or Select, Update using sprocs</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Simple-Example-using-aspSqlDataSource-or-Select-Update-using-sprocs/</link><pubDate>Thu, 29 Sep 2011 11:27:50 GMT</pubDate><dc:creator>davidpendry</dc:creator><description>&lt;p&gt;&lt;br /&gt;Thanks Yudi,&lt;br /&gt;&lt;br /&gt;thankyou for the help..&lt;br /&gt;&lt;br /&gt;I require some logic to be evaluated before a delete occurs, which requires some of the bound columns (hidden) to be passed into the delete sproc too. This is where the challenge arises as i currently cannot get the hidden columns to be passed in, even though they are in the delete element list (see below)&lt;br /&gt;&lt;br /&gt;Could you please provide an example of this also.&lt;br /&gt;&lt;br /&gt;David&lt;br /&gt;&lt;br /&gt; &amp;lt;RootTable DataKeyField="MyId"&amp;gt;&lt;br /&gt; &amp;lt;Columns&amp;gt;&lt;br /&gt; &amp;lt;ISWebGrid:WebGridColumn Caption="HiddenId" DataMember="HiddenId" DataType="System.Guid" Name="HiddenId" Width="100px" Visible="false" EditType="NoEdit" &amp;gt;&lt;br /&gt; .....&lt;br /&gt;......&lt;br /&gt;&lt;br /&gt; &amp;lt;DeleteParameters&amp;gt;&lt;br /&gt; &amp;lt;asp:Parameter Name="HiddenId" Type="String" /&amp;gt;&lt;br /&gt; &amp;lt;/DeleteParameters&amp;gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Simple Example using asp:SqlDataSource or Select, Update using sprocs</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Simple-Example-using-aspSqlDataSource-or-Select-Update-using-sprocs/</link><pubDate>Wed, 28 Sep 2011 09:19:20 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;I created a simple sample page of WebGrid where AllowAddNew; AllowDelete; and AllowEdit are enabled. The grid is bind to spTestSelect (stored procedure for select command); spTestInsert (stored procedure for insert command); spTestUpdate (stored procedure for update command); and spTestDelete (stored procedure for delete command) through an ASP.NET SQLDataSource control.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;The data file, northwind.mdf, is available within the WebGridSamples project.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;Please have the attached sample tested on your end and let us know whether it helps or not.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Simple Example using asp:SqlDataSource or Select, Update using sprocs</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Simple-Example-using-aspSqlDataSource-or-Select-Update-using-sprocs/</link><pubDate>Tue, 27 Sep 2011 10:00:45 GMT</pubDate><dc:creator>davidpendry</dc:creator><description>&amp;nbsp;
&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I cant find anywhere a simple example of using your grid with a asp:SqlDataSource and updating with a stored procedure. I have been struggling to get this to work properly..&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>