.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
Sgraph Infotech
Imran Ghani
Post New Web Links

Editable multiple nested gridview

Posted By:      Posted Date: August 23, 2010    Points: 0   Category :ASP.Net
 

Greetings everyone,

I've got this page where I display a 3 level nested gridview. First gridview displays data, 2nd one displays data based on the 1st one's row and 3rd one displays data based on the 2nd gridview. All of this works perfectly, including the edit mode for the 3rd gridview. 

The issue comes when I make each gridview collapsible, again, it works fine but when I click on "Edit" on the 3rd gridview all the grids collapse, I can then re-open them and the "edit mode" is still present and I can still save my updated data. But that collapsing thing is quite annoying.

I based a lot of my code from this page: http://www.codeproject.com/KB/webforms/EditNestedGridView.aspx

And I understand how I can fix my issue on a 2 level nested gridview, by simply adding the C# code:

protected void GridView2_RowEditing(object sender, GridViewEditEventArgs e)
        {
            GridView gvTemp = (GridView)sender;
            gvUniqueID = gvTemp.UniqueID;
            gvEditIndex = e.NewEditIndex;
            GridView1.DataBind();
        }

This makes allows me to save the index and prevent it from collapsing when I'm editing. Unfortunately, because I'm actually editing the 3rd gridview, if I code:




View Complete Post


More Related Resource Links

Textbox Editable GridView in ASP.NET

  
This article describes how I made a fully editable gridview in C# using ASP.NET 2. The idea is that the GridView looks and works like an Excel spreadsheet. You see all the cells in the table, and you can edit any of the cells you like, and they are automatically updated (i.e. saved to the database). This is very often how people expect data tables to work in web pages, and I've often seen people clicking in vain on un-editable gridview cells, somehow expecting to edit them, and not understanding that they need to click an Edit button at the end of the row.

Binding the multiple drop down boxes in GridView using JQuery in ASP.NET

  
Here is the code for binding the multiple drop down boxes in GridView using JQuery in ASP.NET

Adding Multiple Columns and Rows in GridView without using a Database

  
This article describes on how to add multiple columns and rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in each TextBoxes on Button Click and retain the GridView data on post back.

GridView Multiple Filter AJAX Control

  
This AJAX control enables the user to filter data within any column inside a GridView. The user can add multiple filters and can delete existing ones too.

Editable Gridview with Textbox, CheckBox, Radio Button and DropDown List

  
This is an example of an editable gridview containing different ASP.NET controls. When user wants to edit values in gridview, she/he can use these controls to edit existing values in Gridview Edit Mode.

Using the Code

search multiple words into textbox and populate all records in gridview related those keywords

  

I have a textbox and a gridview which is bound to a table

what I want to achieve is a solution where lets say there are two records - e.g. "1. Book and 2. Red", i want a user to type in those words and the gridview shows the results as followed;

1. Book

2. Red

I have set up the sql data source and everything and my like operator is this...

LIKE '%' + @record + '%'

how can I solve this problem?


Multiple update statements per row in Gridview Edit

  

I want to set up a gridview that will display data like this

WeekEndingDate Project Category Sun Mon Tues Wed Thu Fri Sat
8/14/2010      proj1   test     2   1   2    3   2   1   0
8/21/2010      proj1   test     0   2   2    2   2   1   0
8/28/2010      proj1   test     0   1  

Nested gridview to show category and forum

  
hi,I would like to do like this forum http://www.vbforums.com/there is category and under its there are all forum of this category to do that , I create 2 tables in DB cat for category have 2 rows ( id,title) and table forum have 3 rows ( id,title,Cat_ID) I can do it with Php but in asp.net I can'tI read in some article to create  nested gridviewI try but I didn't find solution and thanks

how to use nested gridview's rowupdating event

  
Hi all,            I have a GridView within a GridView. I want o access child gridview's rowupdating event. i want to update row.            this is my GridView's code as follows<asp:GridView ID="grdv1" runat="server" AutoGenerateColumns="false" EmptyDataText="No records found" OnRowDataBound="grdv1_RowDataBound" CellPadding="0" Width="500px" CellSpacing="0" BorderWidth="0"> <Columns> <asp:TemplateField> <ItemTemplate> <table width="100%"> <tr> <td align="center"> <asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>' CssClass="nbdcontent"></asp:Label> </td> </tr> <tr> <td style="height: 150px"> <asp:GridView ID="grdv2" runat="server" AutoGenerateColumns="False&

How to find specific nested object type in Gridview

  
Dears, I have a gridview with a nested placeholder in each rows. I nested some checkboxes in each placeholders in each rows dynamically, so their ServerIDs are not the same (I dont want to use nested gridview). at the end in a button event I want to count checked checkboxes in gridview while I can not use findcontrol() method in each rows to find checkboxes due to their different ServerIDs. How can I do this?

Styling of GridView with Multiple Headers

  
Hi,    I want to implement GridView with multiple headers in  WPF. The requirement is such that GridView should show the headers as shown below: Detail info Name ID PhoneNumber   The sample Xaml Code with  which I was able to attain the above GridView presentation of Headers is given below:   XAML code: <Window x:Class="WpfNestedHeaderListView.Window2"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     Title="Window2" Height="300" Width="300">     <UserControl.Resources> <CollectionViewSource       x:Key="PatientInfo"       Source="{Binding Path=DocContext.PatientInformation}"/>   <Style x:Key="HeaderStyle" TargetType="{x:Type GridViewColumnHeader                <Setter Property="Template">                 <Setter.Value>                     <ControlTemplate T

styling of gridview with multiple headers

  
Hi,    I want to implement GridView with multiple headers in  WPF. The requirement is such that GridView should show the headers as shown below: Detail info Name ID PhoneNumber   The sample Xaml Code with  which I was able to attain the above GridView presentation of Headers is given below:   XAML code: <Window x:Class="WpfNestedHeaderListView.Window2"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     Title="Window2" Height="300" Width="300">     <UserControl.Resources> <CollectionViewSource       x:Key="PatientInfo"       Source="{Binding Path=DocContext.PatientInformation}"/>   <Style x:Key="HeaderStyle" TargetType="{x:Type GridViewColumnHeader                <Setter Property="Template">                 <Setter.Value>                     <ControlTemplate T

Styling of GridView with Multiple Headers

  
Hi,    I want to implement GridView with multiple headers in  WPF. The requirement is such that GridView should show the headers as shown below: Detail info Name ID PhoneNumber   The sample Xaml Code with  which I was able to attain the above GridView presentation of Headers is given below:   XAML code: <Window x:Class="WpfNestedHeaderListView.Window2"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     Title="Window2" Height="300" Width="300">     <UserControl.Resources> <CollectionViewSource       x:Key="PatientInfo"       Source="{Binding Path=DocContext.PatientInformation}"/>   <Style x:Key="HeaderStyle" TargetType="{x:Type GridViewColumnHeader                <Setter Property="Template">                 <Setter.Value>                     <ControlTemplate T

Nested Gridview and databinding

  
protected void grdClientPayments_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { GridView gv = (GridView)e.Row.FindControl("grdPayments"); SqlDataSource dbSrc = new SqlDataSource(); dbSrc.ConnectionString = NFMData.DB.GetDBConn(); dbSrc.SelectCommand = "SELECT APR.PaymentID, APR.AdID, PaymentAmount, PaymentDate, CheckNo, APR.Comments " + "FROM AdPaymentReceived APR " + "LEFT OUTER JOIN ISRPayment_Payments IPP ON IPP.PaymentID = APR.PaymentID " + "WHERE ISNULL(IPP.Amount,0) <= 0 AND APR.AdID = " + ((DataRowView)e.Row.DataItem)["AdID"].ToString(); gv.DataSource = dbSrc; gv.DataBind(); foreach (GridViewRow gvRow in gv.Rows) { if (gvRow.RowType == DataControlRowType.DataRow) { decimal PaymentAmount = (decimal)((DataRowView)gvRow.DataItem)["PaymentAmount"]; } } }   So basically what I'm trying to do is do some calculation on the rows in the sub-grid based on some values in the main grid.

Editable Spreasheet-like Gridview

  
I need to display 144 records in some form of Grid/Spreadsheet view.  Currently I have the records being  displayed in a Gridview, however this means that if the user needs to make multiple changes to the data that is being displayed then they would have to hit the edit and then update for each row.  What I would like to be able to do is have them Edit whatever rows and columns they need to and then have them click update once. Is this possible, if yes then how?   Any assistance would be greatly welcomed.

Multiple column headers in Gridview

  
Hi,  I've been trying for the past few hours to add mutliple headers to my grid view but keep failing to get it to show.  There's plenty of examples online that I found but can't seem to get the most simplest to work.  Below is the code I've been using with no success.  I even tried changing the "TableCell" to "TableHeaderCell" but still yields no headers as expected.  Anyone know what I could be doing wrong? protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { GridViewRow headerow = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert); TableCell headercell = new TableCell(); headercell.ColumnSpan = 3; headercell.Text = "My Custom Header"; headerow.Cells.Add(headercell); GridView1.Controls[0].Controls.AddAt(0, headerow); } }

Help:JAVASCRIPT (checkAll) & (Hide/Unhide GridView1) in a Datalist with a nested Gridview

  

Hey guys,

 I'm at my wits end on this one looked/Searched/Played/Experimented and I need your help if you can.

This page is going to be primarily used on a mobile device using Win Mobile 5

 

Need to Accomplish:

  1. Prevent Postback(serverside) of Page using JavaScript (Postback's slow down the page on mobile device)

 

JavaScript Requests:

  1. Hide and UnHide the Nested Gridview1 by Clicking on a imagebutton1 in DataList1icon_minized_collapse.pngicon_expand_collapse.png
  2. CheckBox in DataList1 Checks All and UNChecks All, CheckBox in just the related Gridview1

 

Controls :

  1. Gridview1 nested inside DataList1

 

Note: Datalist1 and Gridview1 have datasource's in production. The Codebehind page is just appling test data to help me figure this out.

 

Thank you all in advance for helping me with this.

Example data below:<

Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend