ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Code Snippets  >>  Programming Code  >>  Dot Net Code  >>  ASP.NET Code
 
 


 

 
 ASP.NET Code interview questions  ASP.NET Code Interview Questions
 VB.NET Code interview questions  VB.NET Code Interview Questions
 C Sharp Code interview questions  C Sharp Code Interview Questions
 ADO.NET Code interview questions  ADO.NET Code Interview Questions
Question
HOw to Build a Nested GridView Control with ASP.NET?
 Question Submitted By :: Swapna
I also faced this Question!!     Rank Answer Posted By  
 
  Re: HOw to Build a Nested GridView Control with ASP.NET?
Answer
# 1
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 ?    2 Yes 1 No
Swapna
 

 
 
 
Other ASP.NET Code Interview Questions
 
  Question Asked @ Answers
 
How to integrate the regional language in asp.net and c# like Telugu, Hindi etc,. send a sample program  2
Code for Sending E-Mail with System.Web.Mail?  1
How to add checkbox to datagrid?  3
HOw to Build a Nested GridView Control with ASP.NET?  1
Give coding for Exception Handling Techniques in ASP.NET? Microsoft2
How to Create Scrollable Micro Windows?  1
How to Export Data to Excel? Eastcom-Systems2
What do you create for easier access of data?  1
Code for Getting Information About A File?  1
How to send e-mail from an ASP.NET application? TCS9
Give coding for Implementing a Fixed GridView Header in ASP.NET?  1
How we implement the paypal in my website and how we make a payment through Credit Card.  1
Code for a Simple Way to Write XML in .NET (XmlTextWriter)  1
 
For more ASP.NET Code Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com