deleting values from the gridview

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2008
Posts: 23
Reputation: kapil.tandon is an unknown quantity at this point 
Solved Threads: 0
kapil.tandon kapil.tandon is offline Offline
Newbie Poster

deleting values from the gridview

 
0
  #1
Nov 6th, 2008
i have created the code like this
  1. <asp:GridView ID="grd" runat="server" AutoGenerateColumns="False"
  2. onselectedindexchanged="grd_SelectedIndexChanged" Width="100%">
  3. <Columns>
  4. <asp:BoundField DataField="ID" HeaderText="Budget ID" />
  5.  
  6. <asp:CommandField HeaderText="Delete" ShowDeleteButton="True" />
  7. </Columns>
  8. </asp:GridView>

a show delete field will appeat at run time.
i want to delete the row from the gridview.can anybody tell me how to do it?when i will click on the delete field at the execution time.
Last edited by peter_budo; Nov 7th, 2008 at 4:08 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,162
Reputation: dickersonka will become famous soon enough dickersonka will become famous soon enough 
Solved Threads: 138
dickersonka dickersonka is offline Offline
Veteran Poster

Re: deleting values from the gridview

 
0
  #2
Nov 7th, 2008
why not just delete the row from your datasource and reload the grid?
Custom Application & Software Development
www.houseshark.net
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 645
Reputation: binoj_daniel is an unknown quantity at this point 
Solved Threads: 17
binoj_daniel's Avatar
binoj_daniel binoj_daniel is offline Offline
DaniWeb Expert

Re: deleting values from the gridview

 
0
  #3
Nov 11th, 2008
Originally Posted by kapil.tandon View Post
i have created the code like this
  1. <asp:GridView ID="grd" runat="server" AutoGenerateColumns="False"
  2. onselectedindexchanged="grd_SelectedIndexChanged" Width="100%">
  3. <Columns>
  4. <asp:BoundField DataField="ID" HeaderText="Budget ID" />
  5.  
  6. <asp:CommandField HeaderText="Delete" ShowDeleteButton="True" />
  7. </Columns>
  8. </asp:GridView>

a show delete field will appeat at run time.
i want to delete the row from the gridview.can anybody tell me how to do it?when i will click on the delete field at the execution time.
Do you only want to delete the row from the GridView and not from the DataBase?
Reply With Quote Quick reply to this message  
Join Date: Dec 2009
Posts: 1
Reputation: sekharM is an unknown quantity at this point 
Solved Threads: 0
sekharM sekharM is offline Offline
Newbie Poster
 
0
  #4
19 Days Ago
HI...
It will work do like this.. ...

<Columns>
</asp:TemplateField>
<asp:CommandField
ButtonType = "Button"
ShowEditButton = "True" CausesValidation="false"
ShowDeleteButton = "True" HeaderText="Edit Controls"
/>
</Columns>
</asp:GridView>
<aspqlDataSource ID="SqlDailyDatasource" runat="server"
ConnectionString="<%$ ConnectionStrings:ChdbConnectionString %>"
SelectCommand="Select * from Daily"
DeleteCommand="Delete from Daily where ItemsNo=@ItemsNo"
</aspqlDataSource>
Reply With Quote Quick reply to this message  
Reply

Message:



Other Threads in the ASP.NET Forum


Views: 1229 | Replies: 3
Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC