Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 6th, 2006, 09:41 PM
Registered User
 
Join Date: Apr 2006
Location: St. Paul, Mn, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default master/detail page

Hi all,
Can someone tell me if it is possible to use the gridview control to create a master page and deail page. I am not sure if this control can be use for both of them, master/detail page at the same time.

thanks

Reply With Quote
  #2 (permalink)  
Old April 7th, 2006, 12:14 AM
Friend of Wrox
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,346
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You can use 2 griview to show Master/Detail relationships. I suggest using a gridview for the Master table and a details view for viewing the detail rows.

Jim

Reply With Quote
  #3 (permalink)  
Old April 7th, 2006, 09:36 AM
Registered User
 
Join Date: Apr 2006
Location: St. Paul, Mn, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you jim
The reason I wanted to use two gridview controls for master/detail page instead of one gridview and detail view control is that because when user click the link from the master page I would like them to see the records in a tabular form and i do not know if this can be done in detail control.
thanks

Reply With Quote
  #4 (permalink)  
Old April 7th, 2006, 04:51 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,346
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You can do that to, it is not a problem to do.

Reply With Quote
  #5 (permalink)  
Old April 7th, 2006, 05:32 PM
Registered User
 
Join Date: Apr 2006
Location: St. Paul, Mn, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks jim agin for taking time to respond to my post. below is the code that i used to create both master and detail page using gridview control.When I click the link from the master page the detail page comes up blank and i do not know what this is happenig.Could you please look at the code and give me a clue what i should do to fix it. thanks and have a blessed weekend



Master page
***********************
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="master.aspx.vb" Inherits="_Default" %>

<!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>
        <span style="font-weight: bold; color: #333366; font-style: italic; font-variant: normal">
        Master-Detail Page 1:</span><br />
        <br />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White"
            BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataKeyNames="LCONTID"
            DataSourceID="SqlDataSource1" Width="100%">
            <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
            <Columns>
                <asp:BoundField DataField="MIN(J.ROUTE)" HeaderText="T.H. Number" SortExpression="MIN(J.ROUTE)">
                    <ItemStyle Font-Size="Small" HorizontalAlign="Left" />
                    <HeaderStyle Font-Size="Small" HorizontalAlign="Left" />
                </asp:BoundField>
                <asp:BoundField DataField="LETTING" HeaderText="Letting Date" ReadOnly="True" SortExpression="LETTING">
                    <ItemStyle Font-Size="Small" HorizontalAlign="Left" />
                    <HeaderStyle Font-Size="Small" HorizontalAlign="Left" />
                </asp:BoundField>
                <asp:BoundField DataField="CALL" HeaderText="Call Number" ReadOnly="True" SortExpression="CALL">
                    <ItemStyle Font-Size="Small" HorizontalAlign="Left" />
                    <HeaderStyle Font-Size="Small" HorizontalAlign="Left" />
                </asp:BoundField>
                <asp:BoundField DataField="LCONTID" HeaderText="Contract Id" SortExpression="LCONTID">
                    <ItemStyle Font-Size="Small" HorizontalAlign="Left" />
                    <HeaderStyle Font-Size="Small" HorizontalAlign="Left" />
                </asp:BoundField>
                <asp:BoundField DataField="CPROJNUM" HeaderText="S.P. Number" SortExpression="CPROJNUM">
                    <ItemStyle Font-Size="Small" HorizontalAlign="Left" />
                    <HeaderStyle Font-Size="Small" HorizontalAlign="Left" />
                </asp:BoundField>
                <asp:BoundField DataField="CCNTY1" HeaderText="County Number" SortExpression="CCNTY1">
                    <ItemStyle Font-Size="Small" HorizontalAlign="Left" />
                    <HeaderStyle Font-Size="Small" HorizontalAlign="Left" />
                </asp:BoundField>
                <asp:BoundField DataField="CFACSSUP" HeaderText="District" SortExpression="CFACSSUP">
                    <ItemStyle Font-Size="Small" />
                    <HeaderStyle Font-Size="Small" HorizontalAlign="Left" />
                </asp:BoundField>
                <asp:HyperLinkField DataNavigateUrlFields="LCONTID" DataNavigateUrlFormatString="detail.aspx?lcontid={ 0}"
                    Text="Details..." HeaderText="Details" >
                    <ItemStyle Font-Size="Small" HorizontalAlign="Left" />
                    <HeaderStyle Font-Size="Small" HorizontalAlign="Left" />
                </asp:HyperLinkField>
            </Columns>
            <RowStyle BackColor="White" ForeColor="#330099" />
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
            <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT DISTINCT Min(J.ROUTE),L.LETTING, L.CALL,L.LCONTID,Q.CPROJNUM,Q.CFACSSUP,Q.CCNTY1 FROM VENDOR V, VENDADDR R, LETPROP L, PLANHOLD P,PROPOSAL Q, PROJECT J,PROPPROJ K WHERE V.VENDOR = R.VENDOR AND K.CONTID = Q.CONTID AND K.PCN = J.PCN AND L.LCONTID = K.CONTID AND P.VENDOR = V. VENDOR AND L.LETTING = P.LETTING AND P.LETTING = '06042801' AND L.CALL = P.CALL AND R.ADDRNUM = P.BILLTO group by V.VENDOR,R.ADDRNUM, V.VNAMEL, R.AADDR1,P.BILLTO,R.ACITY, R.ASTATE, R.AZIPCODE,R.VASST1,R.APHONE,L.LETTING, L.CALL,L.LCONTID,Q.CPROJNUM,Q.CFACSSUP,Q.CCNTY1">
        </asp:SqlDataSource>

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

****************************
detail page:
*******************************
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="detail.aspx.vb" Inherits="detail" %>

<!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>
        <span style="font-weight: bold; color: #333366; font-style: italic; font-variant: normal">
            Page 2..........<br />
            Vendor List For Current Letting:<br />
            Please work for me I am running out of patient if you do now work soon i might abandon
            you please work for me......<br />
        </span>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="LCONTID" DataSourceID="SqlDataSource2" CellPadding="4" ForeColor="#333333" GridLines="None" Width="100%">
            <Columns>
                <asp:BoundField DataField="LCONTID" HeaderText="Contract Id" SortExpression="LCONTID" />
                <asp:BoundField DataField="LETTING" HeaderText="Letting Date" SortExpression="LETTING" />
                <asp:BoundField DataField="RT" HeaderText="Route Number" SortExpression="RT" />
                <asp:BoundField DataField="VENDOR" HeaderText="Vendor" SortExpression="VENDOR" />
                <asp:BoundField DataField="ADDRNUM" HeaderText="Address" SortExpression="ADDRNUM" />
                <asp:BoundField DataField="VNAMEL" HeaderText="Vendor Name" SortExpression="VNAMEL" />
                <asp:BoundField DataField="AADDR1" HeaderText="Address 2" SortExpression="AADDR1" />
            </Columns>
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <EditRowStyle BackColor="#999999" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand='SELECT DISTINCT "LCONTID", "LETTING", "RT", "VENDOR", "ADDRNUM", "VNAMEL", "AADDR1", "BILLTO" FROM "DETAILPHLFORBIDLET" WHERE ("LCONTID" = :LCONTID)'>
            <SelectParameters>
                <asp:QueryStringParameter Name="LCONTID" QueryStringField="LCONTID" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>

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



Reply With Quote
  #6 (permalink)  
Old April 7th, 2006, 11:49 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,346
Thanks: 0
Thanked 5 Times in 5 Posts
Default

I would need to see your codebehind to help you determine what is wrong. Also, to simplify things, you can place the details grid on the same page.

Reply With Quote
  #7 (permalink)  
Old April 12th, 2006, 10:04 AM
Registered User
 
Join Date: Apr 2006
Location: St. Paul, Mn, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

there is no code behind. I just used visual studio 2005 to create it.the code that i posted is the entire to create both detail and master page. thanks

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
master-detail hhpatek ADO.NET 0 April 3rd, 2008 03:53 PM
Master Detail prasanta2expert Access VBA 1 October 1st, 2007 07:37 AM
Need Help Master Detail page ollie281 Dreamweaver (all versions) 0 August 7th, 2006 01:35 PM
Master/Detail page yteferi ASP.NET 2.0 Basics 1 April 5th, 2006 05:06 PM



All times are GMT -4. The time now is 02:16 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.