Hi All,
I've been stuck on this for a little while, so I hope someone will be able to help me.
I've got a parent gridview showing the sales orders headers, then within this gridview a child gridview showing the lines. I use a CollapsiblePanelExtender to show the lines.
All this works fine.
However, I've got an "edit" button in the lines that is firing the rowEditing event but the line doesn't change to the edit mode.
Here is the aspx code
<asp:UpdatePanel ID="pnlUpdate" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false"><ContentTemplate><asp:GridView ID="GridViewOrderRequests" runat="server" ForeColor="#333333" Width="100%" AutoGenerateColumns="False" GridLines="None" DataSourceID="SqlDataSourceOrderRequests" AllowSorting="True" EnableTheming="True" OnRowCreated="GridViewOrderRequests_RowCreated" DataKeyNames="No_"><Columns><asp:TemplateField><HeaderTemplate><table class="tabExpand" width="100%"><tr><th width="5%"></th><th class="thExpand" width="10%">No</th><th class="thExpand" width="10%">Customer No</th><th class="thExpand" width="75%">Customer Name</th></tr></table></HeaderTemplate><ItemTemplate><asp:Panel ID="pnlOrderRequests" runat="server" ><table class="tabExpand" width="100%"><tr><td class="tdExpand" width="5%"><asp:Image ID="imgCollapsible" runat="server" /></td><td class="tdExpand" width="10%"><asp:Label ID="Label1" runat="server" Text='<%# Bind("[No_]") %>'></asp:Label></td><td class="tdExpand" width="10%"><asp:Label ID="Label5" runat="server" Text='<%# Bind("[Customer No_]") %>'></asp:Label></td><td class="tdExpand" width="75%"><asp:Label ID="Label6" runat="server" Text='<%# Bind("[Customer Name]") %>'></asp:Label></td></tr></table></asp:Panel><asp:SqlDataSource ID="SqlDataSourceOrderRequestDetail" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="OrderRequestDetail" SelectCommandType="StoredProcedure"><SelectParameters><asp:Parameter Name="RequestNo" Type="String" /></SelectParameters></asp:SqlDataSource><asp:Panel ID="pnlDetails" runat="server" Width="75%" Style="margin-left:20px;margin-right:20px;height:0px;overflow: hidden;"><asp:GridView ID="GridViewOrderRequestDetail" runat="server" CellPadding="2" AutoGenerateColumns="False" DataSourceID="SqlDataSourceOrderRequestDetail" AllowSorting="True" EnableTheming="True" BorderWidth="1px" BorderColor="#5D7B9D" BorderStyle="Solid" RowStyle-Font-Names="calibri" RowStyle-Font-Size="10" HorizontalAlign="Center" DataKeyNames="No_,Line No_" OnRowEditing="GridViewOrderRequestDetail_RowEditing"><Columns><asp:TemplateField HeaderText="Item No" SortExpression="Item No_"><ItemTemplate><asp:Label ID="Label1" runat="server" Text='<%# Bind("[Item No_]") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Description" SortExpression="Description" ItemStyle-HorizontalAlign="left"><ItemTemplate><asp:Label ID="Label2" runat="server" Text='<%# Bind("[Description]") %>'></asp:Label></ItemTemplate><ItemStyle HorizontalAlign="Left"></ItemStyle></asp:TemplateField><asp:TemplateField HeaderText="Unit Of Measure" SortExpression="Unit Of Measure" ItemStyle-HorizontalAlign="left"><ItemTemplate><asp:Label ID="Label3" runat="server" Text='<%# Bind("[Unit Of Measure]") %>'></asp:Label></ItemTemplate><ItemStyle HorizontalAlign="Left"></ItemStyle></asp:TemplateField><asp:TemplateField HeaderText="Unit Price" SortExpression="Unit Price" ItemStyle-HorizontalAlign="left"><ItemTemplate><asp:Label ID="Label4" runat="server" Text='<%# Bind("[Unit Price]", "{0:n2}") %>'></asp:Label></ItemTemplate><ItemStyle HorizontalAlign="Left"></ItemStyle></asp:TemplateField><asp:TemplateField HeaderText="Quantity" SortExpression="Quantity" ItemStyle-HorizontalAlign="Right"><ItemTemplate><asp:Label ID="Label5" runat="server" Text='<%# Bind("[Quantity]", "{0:n2}") %>'></asp:Label></ItemTemplate><EditItemTemplate><asp:TextBox ID="TxtQty" runat="server" Text='<%# Bind("[Quantity]", "{0:n2}") %>'></asp:TextBox></EditItemTemplate><ItemStyle HorizontalAlign="Right"></ItemStyle></asp:TemplateField><asp:TemplateField ShowHeader="False" ItemStyle-Width="3%"><ItemTemplate><asp:ImageButton ID="ImgEditOrderRequest" runat="server" ImageUrl="~/Pictures/EditSmall.png" title="Edit" CommandName="Edit"/></ItemTemplate><HeaderStyle Width="3%" /><ItemStyle Width="3%" HorizontalAlign="Center" /></asp:TemplateField><asp:TemplateField ShowHeader="False" ItemStyle-Width="2%"><ItemTemplate><asp:ImageButton ID="ImgFinaliseOrderRequest" runat="server" OnClientClick="return confirm('Do you want to finalise this order request?');" ImageUrl="~/Pictures/FinaliseSmall.png" title="Finalise"/></ItemTemplate><HeaderStyle Width="2%" /><ItemStyle Width="2%" Font-Names="calibri" HorizontalAlign="Center" /></asp:TemplateField></Columns><EditRowStyle BackColor="#999999" /><FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /><RowStyle BackColor="#F7F6F3" ForeColor="#333333" /><SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /><SortedAscendingCellStyle BackColor="#E9E7E2" /><SortedAscendingHeaderStyle BackColor="#506C8C" /><SortedDescendingCellStyle BackColor="#FFFDF8" /><SortedDescendingHeaderStyle BackColor="#6F8DAE" /></asp:GridView></asp:Panel><asp:CollapsiblePanelExtender ID="ctlCollapsiblePanel" runat="Server" TargetControlID="pnlDetails" CollapsedSize="0" Collapsed="True" ExpandControlID="pnlOrderRequests" CollapseControlID="pnlOrderRequests" AutoCollapse="False" AutoExpand="False" ScrollContents="false" ImageControlID="imgCollapsible" ExpandedImage="~/Pictures/Expand.png" CollapsedImage="~/Pictures/Collapse.png" ExpandDirection="Vertical" /></ItemTemplate></asp:TemplateField></Columns><RowStyle Font-Names="calibri" Font-Size="10pt" /></asp:GridView></ContentTemplate></asp:UpdatePanel>
here is the c#
protected void GridViewOrderRequestDetail_RowEditing(object sender, GridViewEditEventArgs e) { GridView GvLines = sender as GridView; GvLines.EditIndex = e.NewEditIndex; GvLines.DataBind(); }
Any Help would be really appreciated.
Cheers