title: How to bind gridview with data by using loop?
body: <p>I have written code like below lines of code</p>
  
  <pre><code>   protected void grdView_DataBinding(object sender, EventArgs e)
      {
          LicenceBL lbl = new LicenceBL(0);
          DataSet lds = new DataSet();
          lbl.FetchForEdit(lds, LicenseType);
          foreach (GridViewRow row in grdView.Rows)
          {
              Label lblJurisdiction = row.FindControl("lblJurisdiction") as Label;
              TextBox txtDateIssued = row.FindControl("txtEffectiveDate") as TextBox;
              TextBox txtDateExpiration = row.FindControl("txtExpirationDate") as TextBox;
              TextBox txtLicenseNumber = row.FindControl("txtLicenseNumber") as TextBox;
              for (int i = 0; i &lt; lds.Tables[0].Rows.Count; i++)
              {
                  txtLicenseNumber.Text = lds.Tables[0].Rows[i]["LicenceNumber"].ToString();
              }
          }
  
  
      }
  </code></pre>
  
  <p>I want to bind grid view without using datasource property of gridview. The above code is not working... </p>
  
  <p>Let's Suppose lds contains data like</p>
  
  <p>=====================================================</p>
  
  <p>LicenceNumber - LicenceIssueDate</p>
  
  <p>123   - 12/10/2014 </p>
  
  <p>345   - 12/1/2013</p>
  
  <p>=====================================================</p>
  
  <p>Similarily Grid will also contain the data </p>
  
  <p>=====================================================</p>
  
  <p>LicenceNumber - LicenceIssueDate</p>
  
  <p>123   - 12/10/2014 </p>
  
  <p>345   - 12/1/2013</p>
  
  <p>=====================================================</p>
  
  <p>Here is grid view's design </p>
  
  <pre><code>                        &lt;asp:GridView ID="grdView" AutoGenerateColumns="false" OnDataBinding="grdView_DataBinding" BorderWidth="0" runat="server" CssClass="table"&gt;
                              &lt;Columns&gt;
                              &lt;asp:TemplateField HeaderText="License Number"&gt;
                                     &lt;ItemTemplate&gt;
                                        &lt;asp:TextBox ID="txtLicenseNumber" style="padding:12px 5px;" runat="server" /&gt;
                                         &lt;br /&gt;
                                          &lt;asp:RequiredFieldValidator ID="ValReqLN" Display="Dynamic" runat="server"
                                      ErrorMessage="License Number cannot be Blank." ControlToValidate="txtEffectiveDate"&gt;&lt;/asp:RequiredFieldValidator&gt;
                                     &lt;/ItemTemplate&gt;
                                 &lt;/asp:TemplateField&gt;
  
                                      &lt;asp:TemplateField HeaderText="Effective Date"&gt;
                                     &lt;ItemTemplate&gt;
                                      &lt;asp:TextBox ID="txtEffectiveDate" style="padding:12px 5px;" placeholder="(mm/dd/yyyy)" CssClass="datepiker" runat="server"&gt;&lt;/asp:TextBox&gt;
                   &lt;/ItemTemplate&gt;
                   &lt;/asp:TemplateField&gt;
    &lt;/Columns&gt;
  
                          &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>Please help!!! </p>