This is a migrated thread and some comments may be shown as answers.

RadListView Created and Binding from Code Behind

1 Answer 228 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Susi
Top achievements
Rank 1
Susi asked on 14 Nov 2012, 12:17 PM
Dear ALL,

How to create and bind RadListView from code behind like Pege_load event and  all my data's are available in DataTable.how to bind and implement fully by code behind page..

Thanks,

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 14 Nov 2012, 12:53 PM
Hi,

Try the following code to bind listview from code behind.
C#:
protected void Page_Load(object sender, EventArgs e)
{
    RadListView listview = new RadListView();
    form1.Controls.Add(lv1);
    SqlConnection con1 = new SqlConnection(WebConfigurationManager.ConnectionStrings["NorthwindConnectionString3"].ConnectionString);
    SqlCommand cmd = new SqlCommand("SELECT top 5 * FROM [Employees]", con1);
    SqlDataAdapter ad = new SqlDataAdapter(cmd);
    DataSet ds = new DataSet();
    ad.Fill(ds);
    listview.DataSource = ds;
    listview.DataBind();
}

Also check this documentation and demo for more.

Thanks,
Princy.
Tags
ListView
Asked by
Susi
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or