0

i have created the code like this

<asp:GridView ID="grd" runat="server" AutoGenerateColumns="False" 
 onselectedindexchanged="grd_SelectedIndexChanged"        Width="100%">
  <Columns>
         <asp:BoundField DataField="ID" HeaderText="Budget ID" />

 <asp:CommandField HeaderText="Delete" ShowDeleteButton="True" />
    </Columns>
  </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.

4
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by sekharM
0

i have created the code like this

<asp:GridView ID="grd" runat="server" AutoGenerateColumns="False" 
 onselectedindexchanged="grd_SelectedIndexChanged"        Width="100%">
  <Columns>
         <asp:BoundField DataField="ID" HeaderText="Budget ID" />

 <asp:CommandField HeaderText="Delete" ShowDeleteButton="True" />
    </Columns>
  </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?

0

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>
<asp:SqlDataSource ID="SqlDailyDatasource" runat="server"
ConnectionString="<%$ ConnectionStrings:ChdbConnectionString %>"
SelectCommand="Select * from Daily"
DeleteCommand="Delete from Daily where ItemsNo=@ItemsNo"
</asp:SqlDataSource>

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.