RowDeleting event not handled .. deletecommand not enough?

J

jobs

Gridview with datasoure with deletecommand. Why do I need an event
handler? Isn't this enough?

I know this code has worked when I use a fielditemtemplate



<asp:GridView ID="RouteGridView" runat="server" AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="RouteId,DestId"
SkinID="GridView" Width="600px"<EmptyDataTemplate>
No Data
</EmptyDataTemplate>
<Columns>
<asp:CommandField buttonType=Image ShowSelectButton="True"
SelectImageUrl="../App_Themes/WinXP_Silver/Images/edit.gif" />
<asp:CommandField ButtonType=Image ShowDeleteButton=true
DeleteImageUrl="../App_Themes/WinXP_Silver/Images/delete.gif" />
<asp:BoundField DataField="ProductCode" ItemStyle-Width="20"
HeaderText="Product Code"
SortExpression="Productcode" />
.... more here



In code behind, based on input I point it to this datasource:


<asp:SqlDataSource ID="RouteGridSourceAll" runat="server"
ConnectionString="<%$ ConnectionStrings:RTEConnectionString %>"
SelectCommand="SELECT Top 100
dbo.gen_getprodfromplan_fn(Planid) as productcode,* FROM
[GEN_RouteInfo_vw] WHERE startdate<=(case when @Dates='none' then
startdate else cast(@Dates as datetime) end) and enddate>=(case when
@Dates='None' then enddate else cast(@Dates as datetime) end) and
DestCode like (case when @Dest='None' then DestCode else '%'+@Dest+'%'
end) order by StartDate "
DeleteCommand="delete route where destid=@destId;delete
destination where destid=@destid">
<SelectParameters>
<asp:ControlParameter DefaultValue='none'
ControlID="DateFilter" Name="Dates" Type="String" />
<asp:ControlParameter DefaultValue='none'
ControlID="DestFilter" Name="Dest" Type="String" />
</SelectParameters>
<DeleteParameters>
<asp:ControlParameter DefaultValue=''
ControlID="RouteGridView" Name="Destid" Type="String" />
</DeleteParameters>
</asp:SqlDataSource>
</asp:panel>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top