I've been stuck on this for a sevral days and I'm going crazy! So, I hope someone will be able to help me.
I've got a parent gridview showing the sales orders headers, then inside 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.
Ah yes. Your code looks good to me. I'd try a couple of things: try removing the updatepanel and see if it then works. Another things I'd try is put a breakpoint in rowediting and check the value of the index to see if it's reasonable.
Sorry but what do you mean by "teeming"? I already tried to put a breakpoint in the OnRowEditing. It gives me the right info. I can even get the values of the row i clicked on. I tried to put the child gridview outside the parent one and this works fine. The
row I clicked on becomes editable. Very strange!
Haha! Yes, I've tried that before. It collapses the details and doesn't let me expand it anymore. So, I can't even see if it has changed to the edit mode! Thanks for your ideas. Any others? :)
I actually don't know because when I remove the update panel the details collapse and I can't see the lines anymore. It might be on edit mode behind the scene but I can't see anything. Maybe I should try to find a way to expand the lines again after the editing.
Like this I will be able to see if it is on edit mode or not
mathieuk
Member
5 Points
25 Posts
Gridview Edit mode
Feb 01, 2013 04:20 AM|LINK
Hi All,
I've been stuck on this for a sevral days and I'm going crazy! So, I hope someone will be able to help me.
I've got a parent gridview showing the sales orders headers, then inside 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> No </HeaderTemplate> <ItemTemplate> <asp:Panel ID="pnlOrderRequests" runat="server" > <asp:Label ID="Label1" runat="server" Text='<%# Bind("[No_]") %>'></asp:Label> </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" DataKeyNames="No_,Line No_" OnRowEditing="GridViewOrderRequestDetail_RowEditing"> <Columns> <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> </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> <EditIemTemplate> <asp:ImageButton ID="ImgFinaliseOrderRequest" runat="server" ImageUrl="~/Pictures/FinaliseSmall.png" title="Finalise"/> </EditIemTemplate> </asp:TemplateField> </Columns> </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> </asp:GridView> </ContentTemplate> </asp:UpdatePanel>here is the c# code for the row editing
protected void GridViewOrderRequestDetail_RowEditing(object sender, GridViewEditEventArgs e) { GridView GvLines = sender as GridView; GvLines.EditIndex = e.NewEditIndex; GvLines.DataBind(); }thanks for your help
MetalAsp.Net
All-Star
112095 Points
18242 Posts
Moderator
Re: Gridview Edit mode
Feb 01, 2013 05:53 AM|LINK
mathieuk
Member
5 Points
25 Posts
Re: Gridview Edit mode
Feb 01, 2013 06:00 AM|LINK
MetalAsp.Net
All-Star
112095 Points
18242 Posts
Moderator
Re: Gridview Edit mode
Feb 01, 2013 06:11 AM|LINK
mathieuk
Member
5 Points
25 Posts
Re: Gridview Edit mode
Feb 01, 2013 06:28 AM|LINK
MetalAsp.Net
All-Star
112095 Points
18242 Posts
Moderator
Re: Gridview Edit mode
Feb 01, 2013 06:50 AM|LINK
mathieuk
Member
5 Points
25 Posts
Re: Gridview Edit mode
Feb 01, 2013 07:09 AM|LINK
vinz
All-Star
126946 Points
17922 Posts
MVP
Re: Gridview Edit mode
Feb 01, 2013 07:14 AM|LINK
Does it work if you remove the UpdatePanel control?
MessageBox Controls for WebForms | Blog | Twitter | Linkedin
mathieuk
Member
5 Points
25 Posts
Re: Gridview Edit mode
Feb 01, 2013 07:22 AM|LINK
vinz
All-Star
126946 Points
17922 Posts
MVP
Re: Gridview Edit mode
Feb 01, 2013 07:38 AM|LINK
can you try removing the style of your child panel? I can see that you have set the height to 0px with overflow hidden.
MessageBox Controls for WebForms | Blog | Twitter | Linkedin