Jump to content

Datalist Is Showing Up In Source Code, But Not On Web Page?


kwilliams
 Share

Recommended Posts

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

Edited by kwilliams
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...