Bind two datasources into one grid
<p>I have two input controls through which I need to browse and upload the documents.</p>

<p>Below is my ascx</p>

<p>I need to have both teh files uploaded in the gridview.</p>

<p>Below is the code on how I am trying to achieve this.I am creating a datatable for the first upload and then a second datatable for the second upload, and then merging the twodatables into a new combined one and assigning that as the datasource for the gridview.</p>

<pre><code>  namespace Sharepoint.WebParts.Upload_WebPart
  {
  public partial class Upload_WebPartUserControl : UserControl
   {

    protected void Page_Load(object sender, EventArgs e)
    {
        this.btnUpload.Click += new EventHandler(btnUploadUploadClick);
        this.uploadsupport.Click+=new EventHandler(uploadsupport_Click);
        this.btnSubmit.Click += new EventHandler(btnSubmit_Click);
        this.dgdUpload.RowDeleting += new GridViewDeleteEventHandler(dgdUpload_RowDeleting);
    }

    protected void btnUploadUploadClick(object sender, EventArgs e)
    {
                        fileName = System.IO.Path.GetFileName(inputFile.PostedFile.FileName);
            string x = Path.GetExtension(fileName);
            if (fileName != "")
                {
                    if (x == ".zip")
                    {
                        string _fileTime = DateTime.Now.ToFileTime().ToString();
                    string _fileorgPath = System.IO.Path.GetFullPath(inputFile.PostedFile.FileName);
                    string _newfilePath = _fileTime + "~" + fileName;
                    length = (inputFile.PostedFile.InputStream.Length) / 1024;
                    string tempFolder = Environment.GetEnvironmentVariable("TEMP");
                    string _filepath = tempFolder + _newfilePath;
                    inputFile.PostedFile.SaveAs(_filepath);
                    AddRow(fileName, _filepath, length);
                    lblMessage.Text = "Successfully Added in List";
                }
                else
                {
                    lblMessage.Text = "Please upload a zip file";
                    return;
                }
            }

            else
            {
                lblMessage.Text = "Select a File";
                return;
            }

    }
   private void AddMoreColumns()
    {
         dt = new DataTable("DT");
         dc = new DataColumn("FileName", Type.GetType("System.String"));
         dt.Columns.Add(dc);
         dc = new DataColumn("FilePath", Type.GetType("System.String"));
         dt.Columns.Add(dc);
         dc = new DataColumn("FileSize", Type.GetType("System.String"));
         dt.Columns.Add(dc);
         dc = new DataColumn("KB", Type.GetType("System.String"));
         dt.Columns.Add(dc);
         Page.Session["DT"] = dt; 

    }

    private void AddRow(string file, string path, double length)
    {
        dt = (DataTable)Page.Session["DT"];

        if (dt == null)
        {
            AddMoreColumns();
        }
        dr = dt.NewRow();
        dr["FileName"] = file;
        dr["FilePath"] = path;           
        dr["FileSize"] = Convert.ToString(length);
        dr["KB"] = "KB";          
        dt.Rows.Add(dr);
        Page.Session["DT"] = dt;

    }

    Similary i add rows to the datatable dt1.

    protected void bindgridview()
    {
        dt = (DataTable)Page.Session["DT"];
        dt1 = (DataTable)Page.Session["DT1"];

        joineddt = (DataTable)Page.Session["Files"];
        if (joineddt == null)
        {
            joineddt = dt.Copy();
            joineddt.Merge(dt1);
        }

        this.dgdUpload.DataSource = joineddt;
        this.dgdUpload.DataBind();
        Page.Session["Files"] = joineddt;

    }}
</code></pre>

<p>}</p>

<p>Please help me to correct this , also is there a simple way to achieve this.</p>
