i m not able to delete from databasehttp://forums.asp.net/t/1796180.aspx/1?i+m+not+able+to+delete+from+databaseFri, 27 Apr 2012 01:51:20 -040017961804947656http://forums.asp.net/p/1796180/4947656.aspx/1?i+m+not+able+to+delete+from+databasei m not able to delete from database <pre class="prettyprint">asp.net &lt;asp:GridView ID=&quot;GV_Resources&quot; runat=&quot;server&quot; AutoGenerateColumns=&quot;False&quot; DataKeyNames=&quot;Id&quot; DataSourceID=&quot;SqlDataSourceResource&quot; CssClass=&quot;EventGrid&quot; AlternatingRowStyle-CssClass=&quot;alt&quot; EnableModelValidation=&quot;True&quot; Width=&quot;779px&quot; AllowPaging=&quot;True&quot;&gt; &lt;AlternatingRowStyle CssClass=&quot;alt&quot;&gt;&lt;/AlternatingRowStyle&gt; &lt;PagerStyle CssClass=&quot;pgr&quot; HorizontalAlign=&quot;Right&quot; /&gt; &lt;Columns&gt; &lt;asp:BoundField DataField=&quot;Id&quot; HeaderText=&quot;ID&quot; InsertVisible=&quot;False&quot; ReadOnly=&quot;True&quot; SortExpression=&quot;ID&quot; Visible=&quot;False&quot; /&gt; &lt;asp:BoundField DataField=&quot;Title&quot; HeaderText=&quot;Title&quot; SortExpression=&quot;Title&quot; ItemStyle-Width=&quot;605px&quot; /&gt; &lt;asp:ButtonField ButtonType=&quot;Button&quot; CommandName=&quot;EditResources&quot; Text=&quot;Edit&quot; ControlStyle-CssClass=&quot;ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only&quot; /&gt; &lt;asp:TemplateField ItemStyle-Width=&quot;&quot; ShowHeader=&quot;False&quot;&gt; &lt;ItemTemplate&gt; &lt;asp:Button ID=&quot;Delete&quot; runat=&quot;server&quot; CausesValidation=&quot;False&quot; CommandArgument='&lt;%# Bind(&quot;Id&quot;) %&gt;' CommandName=&quot;DeleteResources&quot; Text=&quot;Delete&quot; OnClientClick=&quot;javascript:return deleteItem(this.name);&quot; CssClass=&quot;ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only&quot; /&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; vb.net Protected Sub Gv_Catogary_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GV_Resources.RowCommand Dim currentCommand As String = e.CommandName If currentCommand = &quot;EditResources&quot; Then ElseIf currentCommand = &quot;DeleteResources&quot; Then Dim ID As Integer = Int32.Parse(e.CommandArgument) ResourcesHelper.DeleteResource(ID) GV_Resources.DataBind() End If End Sub</pre> <p>Its not deleting from database</p> 2012-04-24T05:37:21-04:004947879http://forums.asp.net/p/1796180/4947879.aspx/1?Re+i+m+not+able+to+delete+from+databaseRe: i m not able to delete from database <p>Try writing a stored procedure for deletion operation and call it in your code behind file</p> 2012-04-24T07:15:25-04:004947961http://forums.asp.net/p/1796180/4947961.aspx/1?Re+i+m+not+able+to+delete+from+databaseRe: i m not able to delete from database <p>i hav wriiten n calling it too</p> <pre class="prettyprint">ResourcesHelper.DeleteResource(ID)</pre> 2012-04-24T07:44:52-04:004947993http://forums.asp.net/p/1796180/4947993.aspx/1?Re+i+m+not+able+to+delete+from+databaseRe: i m not able to delete from database <p>Is it giving any error?</p> <p>Post here or else</p> <p>check permission for <span class="str">Imgaes/Resource/ folder</span> (share this folder)</p> 2012-04-24T07:56:49-04:004948187http://forums.asp.net/p/1796180/4948187.aspx/1?Re+i+m+not+able+to+delete+from+databaseRe: i m not able to delete from database <p>refer&nbsp;<a href="http://www.csharpaspnetarticles.com/2012/03/delete-files-from-server-directory.html">http://www.csharpaspnetarticles.com/2012/03/delete-files-from-server-directory.html</a></p> 2012-04-24T09:19:20-04:004948337http://forums.asp.net/p/1796180/4948337.aspx/1?Re+i+m+not+able+to+delete+from+databaseRe: i m not able to delete from database <p>remove this <span class="pln"></span><span class="typ">OnClientClick</span><span class="pun">=</span><span class="str">&quot;javascript:return deleteItem(this.name);&quot;</span><span class="pln"><br> </span>in u delete button then check&nbsp; and</p> <p>pls give <span class="pun"></span><span class="typ">DeleteResource</span><span class="pun"></span> method full code...</p> 2012-04-24T10:28:05-04:004953968http://forums.asp.net/p/1796180/4953968.aspx/1?Re+i+m+not+able+to+delete+from+databaseRe: i m not able to delete from database <p>Hi,</p> <p>Please use <strong><span class="typ">CommandName</span><span class="pun">=</span><span class="str">&quot;Delete&quot;</span></strong> instead of <strong><span class="typ">CommandName</span><span class="pun">=</span><span class="str">&quot;DeleteResources&quot;.</span></strong></p> <p>If buttons within a <b>GridView</b> control&nbsp;invokes some of the built-in functionality of the control, you have to&nbsp;set the <b>CommandName</b> property of a button to one of the values: &quot;Cancel&quot;,&quot;Delete&quot;,&quot;Edit&quot;,&quot;Page&quot;,&quot;Select&quot;,&quot;Sort&quot;,&quot;Update&quot;.</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowcommand(v=vs.80).aspx">http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowcommand(v=vs.80).aspx</a></p> 2012-04-27T01:51:20-04:00