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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Sujeet SumanRank #790 · 2.9K reputationPosted Oct 13, 2015, 1:09 AM EDT
Susanta RoutRank #1,557 · 1K reputationPosted Oct 13, 2015, 1:36 AM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Oct 13, 2015, 1:52 AM EDT
Susanta RoutRank #1,557 · 1K reputationPosted Oct 13, 2015, 2:30 AM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Oct 13, 2015, 2:34 AM EDT
Susanta RoutRank #1,557 · 1K reputationPosted Oct 13, 2015, 2:58 AM EDT
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();
}
}
}