943,813 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 1971
  • ASP.NET RSS
Nov 6th, 2008
0

deleting values from the gridview

Expand Post »
i have created the code like this
asp.net Syntax (Toggle Plain Text)
  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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kapil.tandon is offline Offline
23 posts
since Oct 2008
Nov 7th, 2008
0

Re: deleting values from the gridview

why not just delete the row from your datasource and reload the grid?
Reputation Points: 133
Solved Threads: 141
Veteran Poster
dickersonka is offline Offline
1,162 posts
since Aug 2008
Nov 11th, 2008
0

Re: deleting values from the gridview

i have created the code like this
asp.net Syntax (Toggle Plain Text)
  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?
Reputation Points: 25
Solved Threads: 18
Practically a Master Poster
binoj_daniel is offline Offline
645 posts
since Dec 2006
Dec 3rd, 2009
0
Re: deleting values from the gridview
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>
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sekharM is offline Offline
1 posts
since Dec 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Problem with Insert
Next Thread in ASP.NET Forum Timeline: insertion of code using inner html





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC