Wrox Programmer Forums

Need to download code?

View our list of code downloads.

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

You are currently viewing the ASP.NET 3.5 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
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 17th, 2009, 04:47 PM
Banned
Points: 1,561, Level: 16
Points: 1,561, Level: 16 Points: 1,561, Level: 16 Points: 1,561, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2005
Location: , , .
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Question DataList is Showing Up in Source Code, But Not On Web Page?

For some reason, the data for my datalist is showing up in the source code of the page without a problem, but it's not being displayed on the webpage. That page is just blank. Why could this happen?
  #2 (permalink)  
Old November 17th, 2009, 05:00 PM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,957
Thanks: 79
Thanked 1,556 Times in 1,533 Posts
Default

- Fuzzy glasses?
- White text on a white background?
- display: none; on the * selector?
- Broken HTML
- Broken CSS?
- Some script that hides or shows stuff?

In other words: difficult to tell without seeing the actual HTML or, better yet, a live demo page....

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #3 (permalink)  
Old November 17th, 2009, 05:29 PM
Banned
Points: 1,561, Level: 16
Points: 1,561, Level: 16 Points: 1,561, Level: 16 Points: 1,561, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2005
Location: , , .
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default

- Fuzzy glasses? Nope
- White text on a white background? Nope
- display: none; on the * selector? Nope
- Broken HTML Nope
- Broken CSS? Nope
- Some script that hides or shows stuff? Nope

That's what is strange. Below is the code, but I still don't get why it would show up in the source-code without being on the webpage. I've tested all of the stored procedures on the web page and within SQL Server's Management Studio, and they work great. And as I stated, the data is appearing in the source code.

Thanks.

ASP.NET PAGE:

Code:
   <form id="formEmployees" name="formEmployees" enctype="multipart/form-data" runat="server">
        <div id="viewstatecontent">
        <table width="100%" id="Employees">
            <tbody>
            <asp:DataList ID="dlEmployees" runat="server" OnItemDataBound="dtlEmployees_ItemDataBound" RepeatLayout="Flow">
                <HeaderTemplate>
                    <tr>
                        <td>Full Name</td>
                    </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr>
                        <td>
                            <asp:Label ID="lblFullName" runat="server"></asp:Label>
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:DataList>
            </tbody>
        </table>
        </div>
    </form>
</asp:Content>
VB.NET PAGE:
Code:
Partial Class employees
    Inherits System.Web.UI.Page

    'Assign global variables
    Dim sqlConn As SqlConnection
    Dim sqlCmd As SqlCommand
    Dim strConnection As String
    Public strJobID As String = Nothing
    Private ds_details As New DataSet()
    Private cmd_details As SqlDataAdapter = New SqlDataAdapter

    Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)
        'Assign connection string
        strConnection = System.Configuration.ConfigurationManager.AppSettings("strConn_Employees")
        sqlConn = New SqlConnection(strConnection)
        strJobID = Request.QueryString("JobID")

        'Bind data
        BindstrDbRecordID_employeedetails()
    End Sub

    'Bind Data to DataList Populating the Dataset 
    Sub BindstrDbRecordID_employeedetails()
        'SELECT applications from database
        cmd_details = New SqlDataAdapter("spEmployees @jobid = '" & strJobID & "'", sqlConn) 'LIVE

        'Bind data
        cmd_details.Fill(ds_details, "tblEmployees")
        dlEmployees.DataSource = ds_details
        dlEmployees.DataBind()

    End Sub

    'The ItemDataBound Event
    Public Sub dtlEmployees_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs)

        Dim drv As DataRowView = CType(e.Item.DataItem, DataRowView)

        If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then
            'Assign database values
            Dim strDbFName As String = drv.Row("FName").ToString.Trim
            Dim strDbMName As String = drv.Row("MName").ToString.Trim
            Dim strDbLName As String = drv.Row("LName").ToString.Trim

            'Assign label value
            CType(e.Item.FindControl("lblFullName"), Label).Text = strDbLName & ", " & strDbMName & " " & strDbFName
        End If
        drv = Nothing 'Close DataRowView
    End Sub
End Class
  #4 (permalink)  
Old November 17th, 2009, 05:57 PM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,957
Thanks: 79
Thanked 1,556 Times in 1,533 Posts
Default

Quote:
And as I stated, the data is appearing in the source code.
If the data ends up correctly as HTML at the client, then it must be a client side issue. So, rather than posting the server side code, you're better off showing us the client code.

Does using the IE Dev Toolbar or Firebug tell you anything about the state of the page? What happens when you disable CSS and script?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #5 (permalink)  
Old November 17th, 2009, 06:05 PM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,957
Thanks: 79
Thanked 1,556 Times in 1,533 Posts
Default

BTW: Take a look at this:
Code:
   <form id="formEmployees" name="formEmployees" enctype="multipart/form-data" runat="server">
...
    </form>
</asp:Content>
This is odd. </asp:Content> implies the page is a Content Page and is using a MasterPage. However, in that case, <form /> shouldn't be in the content page, but in the master page. Doesn't your master page have a form? (You should get an error if you have two server-side forms).

Are you sure your page is set up and executing correctly?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #6 (permalink)  
Old November 17th, 2009, 06:10 PM
Banned
Points: 1,561, Level: 16
Points: 1,561, Level: 16 Points: 1,561, Level: 16 Points: 1,561, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2005
Location: , , .
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Smile

For security reasons, I couldn't post the entire set of code. But that page is located within a Master Page.

So I just removed all of the Master Page code for testing, and the data appears. So it's obviously a problem with the Master Page.

I appreciate your help!
  #7 (permalink)  
Old November 17th, 2009, 06:19 PM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,957
Thanks: 79
Thanked 1,556 Times in 1,533 Posts
Default

I don't think security reasons should prohibit you from posting relevant HTML, do they? I mean, you could simply post the HTML, remove all rows / data from the page except for one which you modify slightly and you should be good to go.

Anyway, glad it's solved now.

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #8 (permalink)  
Old November 17th, 2009, 06:22 PM
Banned
Points: 1,561, Level: 16
Points: 1,561, Level: 16 Points: 1,561, Level: 16 Points: 1,561, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2005
Location: , , .
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Honestly, for me to copy and paste the entire set of code, including stored procedures, and then go through every item to remove anything that has actual table names, datalist names, etc is extremely difficult to do. When I've done it in the past, I've received feedback that it was in-fact too much data, and they wanted to get to the meat of the problem. I guess you can never really win when it comes to posting code.

Anyway, thanks again. Sorry to have bothered you. It was not my intent.
  #9 (permalink)  
Old November 17th, 2009, 06:34 PM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,957
Thanks: 79
Thanked 1,556 Times in 1,533 Posts
Default

No no no, you misunderstood me. First of all, you're not bothering me. I could simply decide ignore you if you did. ;-)

But you misunderstood my request. I asked you about the *client side* code; e.g. the HTML that ends up in the browser. This has nothing to do with server side code or stored procedures; but simply with the final HTML that ends up at the clinet.
Since you said the HTML looked good (or at least contained what you expected), it was clearly a client side issue, so looking at just the client HTML would have shed some light on the issue.

See what I mean? Are you aware of the differences between client side and server side code? (Not being funny, I see many developers that don't)

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #10 (permalink)  
Old November 17th, 2009, 06:39 PM
Banned
Points: 1,561, Level: 16
Points: 1,561, Level: 16 Points: 1,561, Level: 16 Points: 1,561, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2005
Location: , , .
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes I am aware of client-side vs. server-side, and I knew what you meant. But I had discovered the Master Page thing by then, so I was good-to-go. I still haven't figured out what is causing it within the Master Page, but as you suggested originally, I believe it's the CSS. So I'm delving into it as we speak.

I do know that I was confused on whether it was client-side or server-side until you mentioned it, which led me to test it without the Master Page/CSS. So your questions were very helpful.

I do thank you for your help. I wasn't intending on seeming unhappy with your help. I just felt bad that I posted it in the first place without more details and/or further testing.

Thanks for your help. You and the others on this forum are always helpful! Thanks Imar!
 


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
Beginning C# Web Apps - Where's the Source Code??? nebulus All Other Wrox Books 3 April 6th, 2009 10:31 AM
Code to save html page source code? Jaymond Flurrie Access VBA 1 December 18th, 2008 10:28 AM
web crawler source code gottyblues C++ Programming 1 June 13th, 2007 09:21 AM
User controls not showing on web page pdr ASP.NET 1.0 and 1.1 Basics 0 August 10th, 2005 10:02 AM
DataList Is not showing Data using ASP.NET and C# kmazumdar ADO.NET 5 August 20th, 2004 11:18 AM



All times are GMT -4. The time now is 03:10 PM.


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