Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8777643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:19:26+00:00 2026-06-13T19:19:26+00:00

private void btnSaveStudy_Click(object sender, EventArgs e) { string valueFromlbl = string.Empty; for(int i =

  • 0
    private void btnSaveStudy_Click(object sender, EventArgs e)
        {
            string valueFromlbl = string.Empty;

            for(int i = 0; i < tableContent.Rows.Count; i++)
            {
                for(int j = 0; j < tableContent.Rows[i].Cells.Count; j++)
                {
                    foreach(Control ctrl in tableContent.Rows[i].Cells[j].Controls)
                    {
                        Label lbl = ctrl as Label;
                        if(lbl != null)
                        {
                            valueFromlbl = lbl.Text;
                        }
                    }
                }
            }
        }

protected void Page_Load(object sender, EventArgs e)
{
HtmlTable table = null;
                HtmlTableRow row = null;
                HtmlTableCell cell = null;
                studyNumber = studyNumber + 1;
                uniqueID = uniqueID + 1;

                for(int i = 0; i < 5; i++)
                {
                    table = new HtmlTable();
                    row = new HtmlTableRow();

                    tableContent.Controls.AddAt(i, row);
                    for(int j = 0; j < 3; j++)
                    {
                        cell = new HtmlTableCell();
                        cell.Attributes.Add("Class", "csstablelisttd");
                        row.Attributes.Add("Class", "csstextheader");
                        row.Controls.AddAt(j, cell);

                        if(i == 0 && j == 0)
                        {
                            cell.InnerText = "Study : " + Convert.ToInt32(studyNumber);

                        }
                        else if(i == 1 && j == 0)
                        {
                            cell.InnerText = "Modality" + " : " + modality;
                        }
                        else if(i == 2 && j == 0)
                        {
                            cell.InnerText = "Start Date" + " : " + DateTime.Now.ToString("dd-MMM-yyyy");
                        }
                        else if(i == 3 && j == 0)
                        {
                            cell.InnerText = "Accession Number" + " : " + accessionNumber;
                        }
                        else if(i == 4 && j == 0)
                        {
                            Button btnSaveStudy = new Button();
                            btnSaveStudy.ID = "btnSaveStudy" + uniqueID;
                            btnSaveStudy.Text = "Save";
                            btnSaveStudy.Attributes.Add("Class", "cssbutton");
                            cell.Controls.Add(btnSaveStudy);
                            btnSaveStudy.Click += new EventHandler(btnSaveStudy_Click);
                        }
                        if(i == 1 && j == 1)
                        {
                            cell.InnerText = "AE Title" + " : " + schedule_Station_AE_Title;
                        }
                        else if(i == 1 && j == 2)
                        {
                            cell.InnerText = "Station Name" + " : " + schedule_Station_Name;
                        }
                        else if(i == 2 && j == 1)
                        {
                            cell.InnerText = "Start time" + " : " + startTime;
                        }
                        else if(i == 3 && j == 1)
                        {
                            cell.InnerText = "End time" + " : " + endTime;
                        }

                        else if(i == 2 && j == 2)
                        {
                            Label lblPriority = new Label();
                            lblPriority.ID = "lblPriority" + uniqueID;
                            lblPriority.Text = "Priority : ";
                            DropDownList ddlPriority = new DropDownList();
                            ddlPriority.ID = "ddlPriority" + uniqueID;
                            ddlPriority.Attributes.Add("Class", "csstextbox");
                            ddlPriority.Items.Add(new ListItem("MEDIUM", "4"));
                            ddlPriority.Items.Add(new ListItem("STAT", "1"));
                            ddlPriority.Items.Add(new ListItem("HIGH", "2"));
                            ddlPriority.Items.Add(new ListItem("ROUTINE", "3"));
                            ddlPriority.Items.Add(new ListItem("LOW", "5"));
                            cell.Controls.Add(lblPriority);
                            cell.Controls.Add(ddlPriority);
                        }
                        else if(i == 3 && j == 2)
                        {
                            Label lblStudy = new Label();
                            lblStudy.ID = "lblStudy" + uniqueID;
                            lblStudy.Text = "Study : ";
                            DropDownList ddlStudyList = new DropDownList();
                            ddlStudyList = BindStudy(ddlStudyList, Convert.ToInt32(acqModalityID), uniqueID);
                            ddlStudyList.Attributes.Add("Class", "csstextbox");
                            cell.Controls.Add(lblStudy);
                            cell.Controls.Add(ddlStudyList);
                        }
                    }
                }
            }}
I have added controls to table cell but not find any control
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:19:28+00:00Added an answer on June 13, 2026 at 7:19 pm

    This appears to be an issue with the execution order. Remember that your controls are not added until after your click event. So when your button click fires, the controls need to have been re-added before you can check for their existence.

    (I would post this as a comment, but evidently, as I am new, I don’t have enough points)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

private void button1_Click(object sender, EventArgs e) { Insert(); } private int Insert() { string
private void button1_Click(object sender, EventArgs e) { for (int i = 0; i <
private void btnMiles_Click(object sender, EventArgs e) { try { int milesless200 = int.Parse(txtMiles.Text); int
private void button1_Click(object sender, EventArgs e) { string name; name = textBox5.Text; SqlConnection con10
private void dateTimePicker1_ValueChanged(object sender, Series myseries, int multiplier, EventArgs e) { if (datelimitsset ==
private void dgv_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { foreach (DataGridViewRow r in dgv.Rows) r.Visible =
private void button8_Click(object sender, EventArgs e) { List<long> averages; long res = 0; _fi
private void button5_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(Data Source=MAZI-PC\\PROJECTACC;Initial Catalog=programDB;Integrated
private void btnBrowserGo_Click(object sender, EventArgs e) { browser.Navigate(txtBrowserURL.Text); } The code above directs the
private void btnMail_Click(object sender, EventArgs e) { new formCustomerReportMailer().Show(); } Is it ill-advised to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.