?
Solved

edit inner gridview

Posted on 2011-03-12
4
Medium Priority
?
351 Views
Last Modified: 2012-05-11
I have an inner grid I want to edit.  When I click the inner grid edit button nothing shows from the inner grid.  How can I edit the inner grid? I am using VB net to code.
0
Comment
Question by:kw66722
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 6

Expert Comment

by:AkAlan
ID: 35117936
CAn you post the code for your grid?
0
 
LVL 1

Author Comment

by:kw66722
ID: 35123590
To explain is better:
 I have two tables saved in a SQL database one table (parent) has the title for the field the other has the detailed (child) data based on the id of the parent table.  I want to edit the rows from the child table and not the parent table.  I have attached the possible layouts.  I tried to do this with 2 gridviews and could not get the edit to work for the inner grid.

  <asp:GridView ID="titleGrid" runat="server" AutoGenerateColumns="False"
                DataSourceID="titleSP" DataKeyNames="Key"
                ShowHeader="False">
                <Columns>
                    <asp:TemplateField Visible="False">
                        <ItemTemplate>
                            <asp:Label ID="keyLabel" runat="server" Text='<%# Bind("Key") %>'></asp:Label>
                        </ItemTemplate>
                       </asp:TemplateField>
                                           
                       
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:Label ID="Label10" runat="server" Text='<%# Bind("title") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                               
                    <asp:TemplateField>
                        <ItemTemplate>
                         <asp:GridView ID="DetailGrid" runat="server" DataSourceID="detailSP"
                AutoGenerateColumns="False" DataKeyNames="Key">
                <Columns>
                    <asp:TemplateField ShowHeader="False">
                        <EditItemTemplate>
                            <asp:Button ID="Button1" runat="server" CausesValidation="True"
                                CommandName="Update" Text="Save" />
                            &nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False"
                                CommandName="Cancel" Text="Cancel" />
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Button ID="Button1" runat="server" CausesValidation="False"
                                CommandName="Edit" Text="Edit" />
                        </ItemTemplate>
                     <ItemStyle Font-Names="verdana,arial,helvetica" Font-Size="9px" />
                    </asp:TemplateField>
                    <asp:TemplateField Visible="False">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox1" runat="server"
                                Text='<%# Bind("Key") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("Key") %>'></asp:Label>
                        </ItemTemplate>
                       <ItemStyle Font-Names="verdana,arial,helvetica" Font-Size="9px" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="data" SortExpression="data">
                        <EditItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Eval("data1") %>'></asp:Label>
                           
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label2" runat="server" Text='<%# Bind("data1") %>'></asp:Label>
                         </ItemTemplate>
                            <ItemStyle Font-Names="verdana,arial,helvetica" Font-Size="9px" />
                             <HeaderStyle Font-Names="verdana,arial,helvetica;" Font-Size="9px" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="data2" >
                        <EditItemTemplate>
                            <asp:Label ID="Label2" runat="server" Text='<%# Eval("data2") %>'></asp:Label>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label3" runat="server" Text='<%# Bind("data2") %>'></asp:Label>
                        </ItemTemplate>
                           <ItemStyle Font-Names="verdana,arial,helvetica" Font-Size="9px" />
                    </asp:TemplateField>
                 
                </Columns>
               
                   <AlternatingRowStyle BackColor="#99CCFF" />
                  <SelectedRowStyle BackColor="#0033CC" />
               
            </asp:GridView>
            <asp:SqlDataSource ID="detailSP" runat="server"
                ConnectionString="<%$ ConnectionStrings:sql %>"
                SelectCommand="sp_detail" SelectCommandType="StoredProcedure"
                updateCommand="sp_detail"  UpdateCommandType="StoredProcedure">
                <SelectParameters>
                    <asp:ControlParameter ControlID="titleGrid" Name="key"
                        PropertyName="SelectedValue" Type="Int32" />
                 </SelectParameters>          

                <UpdateParameters>
                    <asp:Parameter Name="Key" Type="Int32" />
                    <asp:Parameter Name="data1" Type="Int32" />
                    <asp:Parameter Name="data2" Type="String" />
                </UpdateParameters>
            </asp:SqlDataSource>
                          </ItemTemplate>
                      </asp:TemplateField>
                </Columns>
     
            </asp:GridView>
           
            <asp:SqlDataSource ID="titleSP" runat="server"
                ConnectionString="<%$ ConnectionStrings:sql %>"
                SelectCommand="sp_title" SelectCommandType="StoredProcedure">
                <SelectParameters>
                    <asp:ControlParameter ControlID="middleimg$teamHotelID" Name="team_hotel_id"
                        PropertyName="Value" Type="Int32" />
                    <asp:ControlParameter ControlID="middleimg$eventID" Name="event_key_id"
                        PropertyName="Value" Type="Int32"  />
                </SelectParameters>
            </asp:SqlDataSource>      
               
           

sampleLayouts.doc
0
 
LVL 1

Accepted Solution

by:
kw66722 earned 0 total points
ID: 35176283
No sure how I got this to work I got it working
0
 
LVL 1

Author Closing Comment

by:kw66722
ID: 35213310
I got the code to work.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question