List View

Jan 11 2015 9:56 AM

<%--code provided by getcodesnippet.com--%>














User ID User Name Contact Number Email





<%# Eval("User_Id")%>


<%# Eval("User_Name")%>


<%# Eval("Contact_Number")%>


<%# Eval("Email")%>



-------code----
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;


public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// code provided by getcodesnippet.com
SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=CPD_TEST;User ID=sa;Password=sunil");
SqlCommand cmd = new SqlCommand("Select * From Table1", conn);
conn.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
conn.Close();

ListView1.DataSource = dt;
ListView1.DataBind();

}
}
-------------------------------
This Control Not Show in Any Browser.
Please Solve Problem.
 

Answers (1)