How to show datalist inside gridview.?
how to show data in datalist inside gridview from database
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Susanta RoutPosted Oct 13, 2015, 6:58 AM
Name
Date
<%#Eval("STATUS")%>
{
show();
}
public void show()
{
SqlConnection cn = new SqlConnection("user id=sa;password=sa123;server=localhost;database=Test");
SqlDataAdapter da = new SqlDataAdapter("select distinct NAME from Temp", cn);
DataTable dt = new DataTable();
da.Fill(dt);
grdView.DataSource = dt;
grdView.DataBind();
}
public void show_status()
{
}
protected void grdView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//int name = Convert.ToInt32(grdView.DataKeys[e.Row.RowIndex].Values[0]);
Label lblname = (Label)e.Row.FindControl("lblName");
DataList DataList1 = ((DataList)e.Row.FindControl("dlview"));
SqlConnection cn = new SqlConnection("user id=sa;password=sa123;server=localhost;database=Test");
SqlDataAdapter da1 = new SqlDataAdapter("select STATUS from Temp where NAME="+lblname.Text+"", cn);
DataTable dt1 = new DataTable();
da1.Fill(dt1);
DataList1.DataSource = dt1;
DataList1.DataBind();
}
}
}
Rajeesh MenothPosted Oct 13, 2015, 6:34 AM
Susanta RoutPosted Oct 13, 2015, 6:30 AM
Rajeesh MenothPosted Oct 13, 2015, 5:52 AM
Susanta RoutPosted Oct 13, 2015, 5:36 AM
Sujeet SumanPosted Oct 13, 2015, 5:09 AM