Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


HOw to Build a Nested GridView Control with ASP.NET?

Answers were Sorted based on User's Feedback



HOw to Build a Nested GridView Control with ASP.NET? ..

Answer / swapna

The steps in creating Datagrid are

1) Create a new Web page in project.
2) Add a GridView to that page.
3) Define bound columns for every element of data in
datagrid.

4) Convert one or more bound columns into a template column
by clicking on the tag at the top-left corner of the
GridView.

5) select Edit columns from the smart menu, select the
field to convert, and click the link for converting a
bound column to a template column.

6) Close the Fields dialog.
7) Add a UserControl to your project.



8) Click the Smart tag on the GridView again and select
Edit Templates.

9) Drag and drop the UserControl from the solution explorer
to the ItemTemplate, remove the existing Label and TextBox,
and click Edit UserControl from the Smart tag menu.

10) Add a second GridView to the UserControl and you have
the basic design.



After completing all these steps Asp.net code looks like
this.



<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="Default.aspx.vb" Inherits="_Default" %>

<%@ Register Src="Orders.ascx" TagName="Orders"
TagPrefix="uc2"%>

<%@ Register Src="OrdersControl.ascx"
TagName="OrdersControl" TagPrefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server"
Height="191px" Width="325px"
AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="CustomerID"
HeaderText="Customer ID">
<ItemStyle VerticalAlign="Top" />
<HeaderStyle Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="CompanyName"
HeaderText="Company Name">
<ItemStyle VerticalAlign="Top" />
<HeaderStyle Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="ContactName"
HeaderText="Contact Name">
<ItemStyle VerticalAlign="Top" />
<HeaderStyle Wrap="False" />
</asp:BoundField>
<asp:TemplateField HeaderText="Order Shipping
Details">
<EditItemTemplate>
&nbsp;
</EditItemTemplate>
<ItemTemplate>
<uc2:Orders ID="Orders1" runat="server"/>
</ItemTemplate>
<ItemStyle VerticalAlign="Top" />
<HeaderStyle Wrap="False" />
</asp:TemplateField>
</Columns>
</asp:GridView>

</div>
</form>
</body>
</html>

Is This Answer Correct ?    15 Yes 10 No

HOw to Build a Nested GridView Control with ASP.NET? ..

Answer / geo

i gave general solution
Nesting GridView controls in ASP.NET were described in that
almost “canonical” Microsoft walkthrough [1]. In general,
it requires creating of two GridView controls: the first
one serving as a container or master GridView1 with its own
DataSource1 (SqlDataSource, AccessDataSource, etc.) and
second "nested" GridView2 with its underlying DataSource2
residing within a TemplateField in master GridView1.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More ASP.NET Code Interview Questions

Code for Sending E-Mail with System.Web.Mail?

2 Answers  


Data Reader Vs DataSet

5 Answers   TCS,


i have a gird with columns all are coming from database,this will bind in item templete in gridview as textboxex.and i have button below named Update.i want to update all the records in the grid,but if user change the value of one textbox,what is the easy way 2 do this

0 Answers   Crompton Greaves,


how to track links visited in google using iframes

0 Answers  


Coding for .NET Delegates?

0 Answers  


ArrayList declaration in .net

0 Answers  


How to Export Data to Excel?

4 Answers   Eastcom Systems,


Give coding for Implementing a Fixed GridView Header in ASP.NET?

1 Answers  


How to send e-mail from an ASP.NET application?

16 Answers   DataPoint, Infosys, Persistent, Radar, TCS, Wipro,


Code for Using Keyboard Events?

0 Answers  


How to get the row index on checking a Checkbox in a ListView

1 Answers  


How to Bind Nested XML to a Repeater Control with Container.DataItem?

0 Answers  


Categories
  • ASP.NET Code Interview Questions ASP.NET Code (46)
  • VB.NET Code Interview Questions VB.NET Code (9)
  • C Sharp Code Interview Questions C Sharp Code (51)
  • ADO.NET Code Interview Questions ADO.NET Code (8)