L
Lisa
Hey all,
I've spent an hour reading posts to see how to delete a row in a
datagrid but none of them work for me (most are VB.NET and I'm coding
in C#). Specifically, I have a checkbox next to each row and a
"Delete" button at the bottom. What I want is for each row that is
checked to get deleted on the click event.... this is what I got..
<asp:datagrid id="grdUpload" runat="server" DataKeyField="UploadID"
AutoGenerateColumns="false" width="424px">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox id="delete" runat="server"></asp:CheckBox>
<asp:HyperLink target=_blank id="hlUploadLink" NavigateUrl='<%#
DataBinder.Eval(Container.DataItem, "URL") %>' Runat="server"
CssClass="NormalBold">
<%# DataBinder.Eval(Container.DataItem, "File") %>
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
<asp:Button id="btnDelete" runat="server" Text="Delete"></asp:Button>
What do I put in the code behind private void btnDelete_Click to
delete the record selected?
Thanks in advance!
Lisa
I've spent an hour reading posts to see how to delete a row in a
datagrid but none of them work for me (most are VB.NET and I'm coding
in C#). Specifically, I have a checkbox next to each row and a
"Delete" button at the bottom. What I want is for each row that is
checked to get deleted on the click event.... this is what I got..
<asp:datagrid id="grdUpload" runat="server" DataKeyField="UploadID"
AutoGenerateColumns="false" width="424px">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox id="delete" runat="server"></asp:CheckBox>
<asp:HyperLink target=_blank id="hlUploadLink" NavigateUrl='<%#
DataBinder.Eval(Container.DataItem, "URL") %>' Runat="server"
CssClass="NormalBold">
<%# DataBinder.Eval(Container.DataItem, "File") %>
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
<asp:Button id="btnDelete" runat="server" Text="Delete"></asp:Button>
What do I put in the code behind private void btnDelete_Click to
delete the record selected?
Thanks in advance!
Lisa