Hi,
I have a GridButtonColumn in my RadGrid which is a delete button for a tag and executes the deletecommand defined in my datasource. This delete actually deletes the pair "contentID" and "tagID" from my table tagsContents. However, as well as the delete of this pair from my table tagsContents, I also want to execute an update of my table tags where I decrease the count column of that tag by 1. This means that as I delete the pair tag - content, I also must decrease the count in the tags table. How can I execute this update command when I click the delete button? Can I associate both commands to the action of clicking the button? Here is my code:
This is the GridButtonColumn:
<telerik:GridButtonColumn ConfirmText="Tem a certeza de que pretende apagar esta tag deste conteúdo?" ConfirmDialogType="RadWindow" ConfirmTitle="Apagar" ButtonType="ImageButton" ButtonCssClass="pointer" CommandName="Delete" Text="Apagar" ItemStyle-Width="10%" UniqueName="ApagarTag" ImageUrl="~/imagens/bt_scorm_falhou.gif" ItemStyle-HorizontalAlign="Center" />
This is the datasource:
<asp:SqlDataSource ID="GET_TAGS_CONT" runat="server" ConnectionString="<%$ ConnectionStrings:lms_bibliotecaConnectionString1 %>"
SelectCommand="SELECT * FROM NL_LMS_BIB_tags INNER JOIN NL_LMS_BIB_tagsConteudos ON NL_LMS_BIB_tags.IDTag=NL_LMS_BIB_tagsConteudos.IDTag AND NL_LMS_BIB_tagsConteudos.IDConteudo = @idconteudo"
DeleteCommand="DELETE FROM [NL_LMS_BIB_tagsConteudos] WHERE IDTag = @IDTag AND IDConteudo=@idconteudo" >
<SelectParameters>
<asp:SessionParameter Name="idconteudo" SessionField="idconteudo" />
</SelectParameters>
<DeleteParameters>
<asp:SessionParameter Name="idconteudo" SessionField="idconteudo" />
<asp:Parameter Name="IDTag" />
</DeleteParameters>
</asp:SqlDataSource>
Thanks!
Marta