Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi friends,
 
I am trying to make a user control (.ascx) to hold data from excelsheet. but not succeed. here is sample of my code. please help me.
 
try
        {
            if (!IsPostBack)
            {                
                  _Connector.FillDataTable(ref ExcelTable, ExcelFileName, ExcelSheet.GetValue(0).ToString());
 
                  
                  for (int i = 0; i <= ExcelTable.Rows.Count - 1; i++)
                  {
                      Image img = new Image();
                      img.ID = "Teacher" + i;
                      img.ImageUrl = (Server.MapPath(ExcelTable.Rows[i][7].ToString()));
                      img.Width = Unit.Pixel(100);
                      img.Height = Unit.Pixel(120);
 
                      Label name = new Label();
                      name.ID = "name" + i;
                      name.Text = ExcelTable.Rows[i][1].ToString();
 
                      Label father = new Label();
                      father.ID = "father" + i;
                      father.Text = ExcelTable.Rows[i][2].ToString();
 
                      Label Dob = new Label();
                      Dob.ID = "dob" + i;
                      Dob.Text = ExcelTable.Rows[i][3].ToString();
 
                      Label Acadamic = new Label();
                      Acadamic.ID = "academic" + i;
                      Acadamic.Text = ExcelTable.Rows[i][4].ToString();
 
                      Label comercial = new Label();
                      comercial.ID = "comercial" + i;
                      comercial.Text = ExcelTable.Rows[i][5].ToString();
 
                      Label experience = new Label();
                      experience.ID = "experience" + i;
                      experience.Text = ExcelTable.Rows[i][6].ToString();
 
                      this.Controls.Add(img);
                      this.Controls.Add(name);
                      this.Controls.Add(father);
                      this.Controls.Add(Dob);
                      this.Controls.Add(Acadamic);
                      this.Controls.Add(comercial);
                      this.Controls.Add(experience);
                  }
            }
        }
 
        catch { }
Posted 4-Mar-13 2:35am
Edited 4-Mar-13 3:31am
v3
Comments
ThePhantomUpvoter at 4-Mar-13 9:23am
   
"but not succeed" is not a helpful description of any kind of a problem.
ryanb31 at 4-Mar-13 14:25pm
   
And what is the problem?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 4 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100