title: How to bind datalist inside gridview?
body: <p>I want to bind datalist inside gridview control</p>
  
  <p>In the below image Step-1,Step-2,... is coming from database and I want to bind it in datalist </p>
  
  <p>I tried with the below code</p>
  
  <p><strong>.aspx</strong></p>
  
  <pre><code> &lt;asp:GridView ID="gvRoadMap" runat="server" AutoGenerateColumns="false" Width="100%"
                      Style="border: 0px solid #cdcdcd" OnRowDataBound="gvRoadMap_RowDataBound" border="0"
                      CellSpacing="1" CellPadding="3" AllowSorting="true"&gt;
                      &lt;Columns&gt;
                            &lt;asp:TemplateField&gt;
                              &lt;HeaderTemplate&gt;
                                  &lt;asp:DataList ID="dlRMStepHeader" runat="server" RepeatDirection="Horizontal"&gt;
                                      &lt;ItemTemplate&gt;
                                          &lt;asp:Label ID="lblStepName" Text='&lt;%#Eval("STEPNAME") %&gt;' runat="server"&gt;&lt;/asp:Label&gt;
                                      &lt;/ItemTemplate&gt;
                                  &lt;/asp:DataList&gt;
                              &lt;/HeaderTemplate&gt;
                          &lt;/asp:TemplateField&gt;
                          &lt;asp:TemplateField&gt;
                          &lt;EditItemTemplate&gt;
                              &lt;asp:DataList ID="dlRMStepItem" OnItemDataBound="dlRMStepItem_ItemDataBound" runat="server"&gt;
  
                              &lt;/asp:DataList&gt;
                              &lt;/EditItemTemplate&gt;
                          &lt;/asp:TemplateField&gt;
                      &lt;/Columns&gt;
                  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p><strong>.cs</strong></p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
      {
          if (!base.IsPostBack)
          {
              objUserInformation = this.Session["USERSECURITYINFO"] as UserSecurityInformation;
              //Presentationlayer_Views_AddRoadMap.USERID = Convert.ToInt64(BusinessEngineFacade.GetBusinessEngineFacade().get_GetSessionUserInformation().UserId);
              //this.hdnRoadMapID.Value = "0";
              if (base.Request.QueryString["ID"] != null)
              {
                  trainingMapID = Convert.ToString(base.Request.QueryString["ID"]);
              }
              this.GetRoadMapData();
          }
      }
  
      private void GetRoadMapData()
      {
          RoadMapManager roadmapMgr = new RoadMapManager();
          DataSet dataSet = roadmapMgr.GetAllRaodMapData(Convert.ToInt64(trainingMapID));
          this.ViewState["RoadMapData"] = dataSet;
          if (dataSet.Tables.Count &gt; 0)
          {
              if (trainingMapID != null)
              {
                  this.txtRoadmapName.Text = Convert.ToString(dataSet.Tables[3].Rows[0][0]);
                  this.txtDescription.Text = Convert.ToString(dataSet.Tables[3].Rows[0][1]);
                  this.chkActive.Checked = Convert.ToBoolean(dataSet.Tables[3].Rows[0][2]);
              }
              else
              {
                  this.txtRoadmapName.Text = "";
                  this.txtDescription.Text = "";
                  this.chkActive.Checked = false;
              }
              this.BindRoadMap(dataSet.Tables[0]);
          }
      }
      private void BindRoadMap(DataTable dt)
      {
          this.gvRoadMap.DataSource = dt;
          this.gvRoadMap.DataBind();
      }
  
      protected void gvRoadMap_RowDataBound(object sender, GridViewRowEventArgs e)
      {
          DataTable dataSource = new DataTable();
          DataList dataList = new DataList();
          if (e.Row.RowType == DataControlRowType.Header)
          {
              dataList = (DataList)e.Row.FindControl("dlRMStepHeader");
              dataSource = ((DataSet)this.ViewState["RoadMapData"]).Tables[1];
              dataList.DataSource = dataSource;
              dataList.DataBind();
          }
          if (e.Row.RowType == DataControlRowType.DataRow)
          {
              dataList = (DataList)e.Row.FindControl("dlRMStepItem");
              dataSource = ((DataSet)this.ViewState["RoadMapData"]).Tables[1];
              dataList.DataSource = dataSource;
              dataList.DataBind();
          }
      }
  
  
  
   ![enter image description here][1]
  </code></pre>
  
  <p>How to design the above image in asp.net?</p>
  
  <p>Any Ideas? Thanks in advance.</p>