kwilliams Posted November 17, 2009 Share Posted November 17, 2009 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? Link to comment Share on other sites More sharing options...
kwilliams Posted November 17, 2009 Author Share Posted November 17, 2009 Here are more details: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: <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: 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 SubEnd Class Link to comment Share on other sites More sharing options...
kwilliams Posted November 17, 2009 Author Share Posted November 17, 2009 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.Thanks anyway. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.