C
chris
I have a perent gridview which includes in a template field a child
gridview. Child gridview includes command buttons for opening
different windows based on its row selected.
I used the code below. The event for RowDataBound is executed, rows
get different color, but event for RowCommand is not executed. What
could be the problem ?
Thanks a lot in advance.
<asp:GridView ID="grv_batches" runat="server"
AutoGenerateColumns="False"
DataKeyNames="country_no,product_no,client_no" CssClass="GridView" >
<Columns>
<asp:ButtonField CommandName="Send" Text="Finish" >
<ControlStyle CssClass="GridView_LinkButtons" />
</asp:ButtonField>
<asp:BoundField DataField="Country_name"
HeaderText="Country" />
<asp:BoundField DataField="product_name"
HeaderText="Product" />
<asp:BoundField DataField="client_name"
HeaderText="Company" />
<asp:TemplateField HeaderText="Details">
<ItemTemplate>
<asp:GridView ID="grv_reports" runat="server"
AutoGenerateColumns="False" CssClass="GridView"
OnRowCommand="grv_subscr_reports_RowCommand"
OnRowDataBound="grv_subscr_reports_RowDataBound">
<Columns>
<asp:ButtonField CommandName="Sub"
Text="S">
<ControlStyle
CssClass="GridView_LinkButtons" />
</asp:ButtonField>
Protected Sub grv_subscr_reports_RowCommand(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs)
If e.CommandName = "Sub" Then
Protected Sub grv_subscr_reports_RowDataBound(ByVal sender As
Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Select Case e.Row.Cells(11).Text 'report status
Case "New"
e.Row.BackColor = Drawing.Color.LightGreen
gridview. Child gridview includes command buttons for opening
different windows based on its row selected.
I used the code below. The event for RowDataBound is executed, rows
get different color, but event for RowCommand is not executed. What
could be the problem ?
Thanks a lot in advance.
<asp:GridView ID="grv_batches" runat="server"
AutoGenerateColumns="False"
DataKeyNames="country_no,product_no,client_no" CssClass="GridView" >
<Columns>
<asp:ButtonField CommandName="Send" Text="Finish" >
<ControlStyle CssClass="GridView_LinkButtons" />
</asp:ButtonField>
<asp:BoundField DataField="Country_name"
HeaderText="Country" />
<asp:BoundField DataField="product_name"
HeaderText="Product" />
<asp:BoundField DataField="client_name"
HeaderText="Company" />
<asp:TemplateField HeaderText="Details">
<ItemTemplate>
<asp:GridView ID="grv_reports" runat="server"
AutoGenerateColumns="False" CssClass="GridView"
OnRowCommand="grv_subscr_reports_RowCommand"
OnRowDataBound="grv_subscr_reports_RowDataBound">
<Columns>
<asp:ButtonField CommandName="Sub"
Text="S">
<ControlStyle
CssClass="GridView_LinkButtons" />
</asp:ButtonField>
Protected Sub grv_subscr_reports_RowCommand(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs)
If e.CommandName = "Sub" Then
Protected Sub grv_subscr_reports_RowDataBound(ByVal sender As
Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Select Case e.Row.Cells(11).Text 'report status
Case "New"
e.Row.BackColor = Drawing.Color.LightGreen