Editable Child GridView inside editable parent gridview


 I need help writing a Paent/Child gridview combination.

I need an editable parent gridview, inside templatefield of parent grid view I need an editable child gridview. Can any one post sample code.

3/10/2009 6:08:30 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 4
Get it on Google Play
Get it on Apple App Store

Hi jameston ,


   <form id="form1" runat="server">
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
            DeleteCommand="DELETE FROM [country] WHERE [countryid] = @countryid" InsertCommand="INSERT INTO [country] ([countryname]) VALUES (@countryname)"
            SelectCommand="SELECT * FROM [country]" UpdateCommand="UPDATE [country] SET [countryname] = @countryname WHERE [countryid] = @countryid">
                <asp:Parameter Name="countryid" Type="Int64" />
                <asp:Parameter Name="countryname" Type="String" />
                <asp:Parameter Name="countryid" Type="Int64" />
                <asp:Parameter Name="countryname" Type="String" />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="countryid"
                <asp:CommandField ShowEditButton="True" />
                <asp:BoundField DataField="countryid" HeaderText="countryid" InsertVisible="False"
                    ReadOnly="True" SortExpression="countryid" />
                <asp:BoundField DataField="countryname" HeaderText="countryname" SortExpression="countryname" />
                        <asp:HiddenField ID="HiddenField1" runat="server" Value='<%# Eval("countryid") %>' />
                        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
                            DeleteCommand="DELETE FROM [city] WHERE [cityid] = @cityid" InsertCommand="INSERT INTO [city] ([cityid], [cityname], [countryid], [des]) VALUES (@cityid, @cityname, @countryid, @des)"
                            SelectCommand="SELECT * FROM [city] WHERE ([countryid] = @countryid)" UpdateCommand="UPDATE [city] SET [cityname] = @cityname, [countryid] = @countryid, [des] = @des WHERE [cityid] = @cityid">
                                <asp:Parameter Name="cityid" Type="Int64" />
                                <asp:Parameter Name="cityname" Type="String" />
                                <asp:Parameter Name="countryid" Type="Int64" />
                                <asp:Parameter Name="des" Type="String" />
                                <asp:Parameter Name="cityid" Type="Int64" />
                                <asp:ControlParameter ControlID="HiddenField1" Name="countryid" PropertyName="Value"
                                    Type="Int64" />
                                <asp:Parameter Name="cityid" Type="Int64" />
                                <asp:Parameter Name="cityname" Type="String" />
                                <asp:Parameter Name="countryid" Type="Int64" />
                                <asp:Parameter Name="des" Type="String" />
                        <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataKeyNames="cityid"
                                <asp:CommandField ShowEditButton="True" />
                                <asp:BoundField DataField="cityid" HeaderText="cityid" ReadOnly="True" SortExpression="cityid" />
                                <asp:BoundField DataField="cityname" HeaderText="cityname" SortExpression="cityname" />
                                <asp:BoundField DataField="countryid" HeaderText="countryid" SortExpression="countryid" />
                                <asp:BoundField DataField="des" HeaderText="des" SortExpression="des" />

Samu Zhang
Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
3/16/2009 2:29:16 AM

Refer this


ITs working..

Better Post your code before asking some thing, some one. So that person helping u will understand u r problem Clearly

Yahoo IM : dotnetruler

I am trying to keep Frequently Asked Questions in my blog
3/16/2009 2:31:14 AM

Similar Artilces:

Add new controls to a gridview row; when editing that row using the edit row feature in the gridview control.
Hi all  I have a questions that looks hard / complex to me, and i know you can help me in this. Q {  I have row in a Gridview and i have an edit option to it. I press the edit button, to edit the values in that row and update data all the way back to the database. Now when i press the edit button, i want a drop down list to be displayed that contain values for a particular field in my grid view. (for now only plain text boxes appear.) } I hope you understand my question, all i need to do is replace the text box controls with a dropdown list when i am editing a row in ...

DataList with Nested Editable/Deletable Gridviews. Gridviews not updating parent on edit/delete.
<DataList "Groups">  <Item>      <DataBound Title in DataList>       <Gridview of Items in "Current Group from DataList">       <SqlDataSource for GridView> </Item></DataList><SqlDataSource for DataList> Everything displays fine, I can edit individual rows in the nested grids and I can insert Rows in the grids.But the edit/delete events will not trigger the DataList to rebind its contents.. so onEdit/onDelete in the gridviews I say "DataList.Dat...

GridView and Javascript
Hey All, I need help from  you. I have a GridView. In the  Edit Item template of the first Column I have a textbox, an user control and hidden field. When I click on the user control it  opens a pop up from which I can choose the required value. The text value is populated in the textbox and Id in the hidden field. Here's the code for edit template.         <EditItemTemplate>                        <table cellpaddin...

GridView child of GridView
I have a Parent GridView and when you click in the Edit one of the columns has a Template Field which has a Child GridView. When you click Edit on the Child GridView I have a Template Field that has a TextBox. How to I retreive this value of the TextBox? GridViewParent-- GridViewChild (Edit - Template Field containing this GridViewChild)----- TextBox inside Template Field in GridViewChild. Thank you.Peace in ChristMarco Napolihttp://www.ourlovingmother.org What you can do as a solution is to override the RowDataBound and try to find the child GridView control. Once you get a reference to...

Gridview inside Repeater: How to edit data in gridview
Hi,I have a gridview inside a repeater. I am wondering how do I change the gridview into edit mode where the selected row will be changed to textbox? This is the code that I have:  1 <asp:Repeater ID="Repeater1" runat="Server"> 2 <ItemTemplate> 3 <asp:SqlDataSource ID="SqlDataSource1" runat="Server" ConnectionString="<%$ MyConnectionString %>"></asp:SqlDataSource> 4 <asp:GridView ID="GridView1" runat="server" AutoGenerateColumn...

How do I fix a Edit GridView Error
Hello, I keep getting this error when I edit and update a gridview.   Server Error in '/Albers_website' Application. Updating is not supported by data source 'SqlHAPSource' unless UpdateCommand is specified. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NotSupportedException: Updating is not supported by data source 'SqlHAPSource' unless UpdateCommand is specified.Source Error: [NotSupporte...

Editable GridView: Need C# code for Editable Gridview web part..!!
  I have created a Sharepoint Web Part programmatically in C# which fetches data from SQL database and displays in a Gridview. Its working fine. Now i need to make this gridview editable so that the changes should be reflected / saved back into SQL Database. I am running oout of time and need help immediately. Can somebody help me in getting the code for Editable Gridview please........???? Thank you Can Sombody help me out here.......... there are so many examples on the web http://msdn2.microsoft.com/en-us/library/ms972948.aspx http://www.experts-exchange.com/Programming/P...

how to pass the controls from child gridview to parent gridview in c#
 Hai.how to pass the controls from child gridview to parent gridview in c# Hi:   You can get the controls in ChildGridView like below. So if you want to get the reference of the control in ParentGridView, you can put them in ParentGridView event handler(like OnRowEditing .etc)        GridViewRow parent_row = ParentGridView.Rows[parent_index];     GridView ChildGridiView =         (GridView)parent_row.FindControl("ChildGridView");     GridViewRow child_row = ChildGridiView...

composite control inside gridview edit
HiI have a composite control which works perfect in almost case. I have a problem with that in gridview edit mode.In my composite control i register some javascript code block, say a function i need to call this function when i click on my control. To register the javascript statements/functions, I am using RegisterClientScriptBlock, which registers in all the other cases except inside the edit mode, even it works in header/footer of the gridview.Can anyone helpme what i am missing in my control so that i works on gridview edit mode too? how i can register the client script when the control ...

using javascript getting value from textbox when edit button is clicked and both controls are present in gridview control
Hi All using javascript I want to get value  from textbox when edit button is clicked and both controls that is texbox and button are present in gridview control .Alok Hi aloksinha83, Please see this post: http://forums.asp.net/t/1069245.aspx Thanks,Qin Dian TangMicrosoft Online Community SupportPlease remember to mark the replies as answers if they help and unmark them if they provide no help....

Can I populate a Gridview outside of the Gridview using my own edit controls ?
I want to be able to populate a GridView control through some edit controls that willbe displayed above my GridView control. Is their a way to do this without using a DetailsView control ? (Refer to the following article) http://www.dotnetbips.com/articles/c1e0ca90-5f5d-47aa-a739-492b562e810a.aspx Or can I have my own edit controls seperately from the GridView control? Actually, all you need to do is to put some textboxes and button. Than on button click insert that data in database and bind data to your gridviewagain. __Please mark post as answer if it helps, if not come back and a...

Direct editing of gridView or Ddatagrid controls without clicking on an EDIT link
I have an application where lots of data is presented to the user in a gridView control and the user needs the option to review and overwrite any values in the cells of the grid.  My users find it very annoying and time consuming to click on an edit link to turn a row of the gridView into edit mode.  Typically, they might jump around and edit a few values in several rows.  Is there any way to present the data in a gridView control, datagrid control or something that looks like a grid where the entire grid is already in edit mode?  Can you make a grid that cont...

GridView control enters edit mode only when I click Edit link twice
Hi all..I have a GridView control in an ASP.NET 2.0 page. I added a column that contains edit, update, cancel buttons. Because I did that, I had to handle RowEditing event or an exception was thrown.Well... this is the body of the RowEditing event:protected void gvParametros_RowEditing(object sender, GridViewEditEventArgs e){      gvParametros.EditIndex = e.NewEditIndex;}The fact is that when page is loaded and I click the edit link, page is refreshed but GridView doesn't enter edit mode. When I press edit link again, GridView enters edit mode.Any help to solve this behavior w...

Gridview validation in my editable gridview
Still stumped on this issue of doing a custom validation on templated textboxes. When in edit mode I wish to validate textbox1 against the contents of textbox2 when the UPDATE link is clicked. How do I capture the contents of either textbox? Must I figure out the selectedrow first? Do I need to do that in the customvalidator procedure or in selectedrowchange or some such standard subproc?   hi, I create a test code example <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0...

Web resources about - Editable Child GridView inside editable parent gridview - asp.net.presentation-controls

ColorFun - Adult Coloring Book With Editable Text on the App Store
Read reviews, compare customer ratings, see screenshots, and learn more about ColorFun - Adult Coloring Book With Editable Text. Download ColorFun ...

Google Play Music iOS app updated with editable playlists and more
... about iPhone , Apps , and iOS continue reading at 9to5Mac . What do you think? Discuss "Google Play Music iOS app updated with editable playlists ...

[Deal Alert] Equil Smartpen 2, Which Converts Your Handwritten Notes Into Editable Digital Copies, Currently ...
If you're in the market for a way to handwrite notes and convert them into a digital format that you can edit, head over to StackSocial right ...

QuickAdvice: TextGrabber Allows You To Capture Text As Editable Text
There are those times when you come across some text in a printed document that you need to make note of. TextGrabber lets you take a picture ...

Price Drop: Text Recognizer Pro ™ OCR regconition app for scan character image and convert to editable ...
Text Recognizer Pro ™ OCR regconition app for scan character image and convert to editable documents 1.1 Device: iOS iPhone Category: Business ...

Facebook makes statuses editable… but is this open to abuse?
It's extremely irritating. You change your Facebook status and immediately notice that you've made a stupid spelling mistake. This could come ...

SALE: Turn your handwritten notes into editable digital copies with the Equil Smartpen
There are times when it’s satisfying to write notes or doodle with a good old pen and paper. The downside is that once you’ve written that note ...

PDF2Office Professional Makes PDF Files Into Editable Office Docs
... This is exactly the situation PDF2Office is for— Edit PDF Files with PDF2Office Professional v6: Convert PDF & Windows XPS files into Editable ...

The Editable 'Print A Cheat-Sheet On An Aquafina Bottle Label And Ace Your Test' Website
... the hell out of some tests, but you know what? I did it in a blaze of glory and HONOR. Just in time for exams comes the White Weasel editable ...

Tablet Cheat Sheet 2.0: Now an editable spreadsheet
... thread and jumped in to help by putting the key info into a web-based spreadsheet. I’ve added more data and also made it publicly editable ...

Resources last updated: 12/30/2015 7:57:11 AM