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

  • SEARCH
  • Home
  • 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 8410529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:12:04+00:00 2026-06-10T00:12:04+00:00

I’m using PostBackUrl to post my control from a firstwebpage.aspx to a secondwebpage.aspx so

  • 0

I’m using PostBackUrl to post my control from a “firstwebpage.aspx” to a “secondwebpage.aspx” so that I would be able to generate some configuration files.

I do understand that I can make use of PreviousPage.FindControl(“myControlId”) method in my secondwebpage.aspx to get my control from “firstwebpage.aspx”and hence grab my data and it worked.

However, it seems that this method does not work on controls which I generated programmically during runtime while populating them in a table in my firstwebpage.aspx.

I also tried using this function Response.Write(“–” + Request[“TextBox1”].ToString() + “–“);
And although this statement do printout the text in the textfield on TextBox1, it only return me the string value of textbox1. I am unable to cast it to a textbox control in the following format too

TextBox temptextBox = (TextBox)Request[“TextBox1”];

My question is, how can I actually access the control which i generated programmically in “firstwebpage.aspx” on “secondwebpage.aspx”?

Please advice!
thanks alot!

//my panel and button in aspx

<asp:Panel ID="Panel2" runat="server"></asp:Panel>

<asp:Button ID="Button1" runat="server" Text="Generate Xml" PostBackUrl="~/WebForm2.aspx" onclick="Button1_Click" />

//this is my function to insert a line into the panel

 public void createfilerow(string b, string path, bool x86check, bool x86enable, bool x64check, bool x64enable)
        {
            Label blank4 = new Label();
            blank4.ID = "blank4";
            blank4.Text = "";
            Panel2.Controls.Add(blank4);

            CheckBox c = new CheckBox();
            c.Text = b.Replace(path, "");
            c.Checked = true;
            c.ID = "1a";
            Panel2.Controls.Add(c);

            CheckBox d = new CheckBox();
            d.Checked = x86check;
            d.Enabled = x86enable;
            d.ID = "1b";
            Panel2.Controls.Add(d);

            CheckBox e = new CheckBox();            
            e.Checked = x64check;
            e.Enabled = x64enable;
            e.ID = "1c";
            Panel2.Controls.Add(e);
    }

//my virtual path in WebForm2.aspx

<%@ PreviousPageType VirtualPath="~/WebForm1.aspx"  %>

//my pageload handler

protected void Page_Load(object sender, EventArgs e)
{  
    if (PreviousPage != null)
    {
        CheckBox tempCheckbox = (CheckBox)Page.PreviousPage.FindControl("1a");
        Button1.Text = tempCheckbox.Text;
    }         
}

//handler which will populate the panel upon clicking

protected void Button7_Click(object sender, EventArgs e)
        {
            //get foldername 

            if (!Directory.Exists(@"myfilepath" + TextBox2.Text))
            {
                //folder does not exist
                //do required actions
                return;
            }
            string[] x86files = null;
            string[] x64files = null;
            string[] x86filespath = null;
            string[] x64filespath = null;
            ArrayList common = new ArrayList();
            if (Directory.Exists(@"myfilepath" + TextBox2.Text + "\\x86"))
                x86files = Directory.GetFileSystemEntries("myfilepath" + TextBox2.Text + "\\x86");
            if (Directory.Exists(@"myfilepath" + TextBox2.Text + "\\x64"))
                x64files = Directory.GetFileSystemEntries("myfilepath" + TextBox2.Text + "\\x64");

            //some codes to convert x64files and x86files to string[]

            //The header for Panel, 4 column
            Label FL = new Label();
            FL.ID = "flavourid";
            FL.Text = "Flavour";
            Panel2.Controls.Add(FL);

            Label filetext = new Label();
            filetext.ID = "filenamelabel";
            filetext.Text = "File(s)";
            Panel2.Controls.Add(filetext);

            Label label86 = new Label();
            label86.ID = "label86";
            label86.Text = "x86";
            Panel2.Controls.Add(label86);

            Label label64 = new Label();
            label64.ID = "label64";
            label64.Text = "x64";
            Panel2.Controls.Add(label64);


            //a for loop determine number of times codes have to be run
            for (int a = 0; a < num; a++)
            {
                ArrayList location = new ArrayList();
                if (//this iteration had to be run)
                {
                    string path = null;
                    switch (//id of this iteration)
                    {
                     case id:
                     path = some network address
                    }

                    //check the current version of iternation
                    string version = //version type;
                    //get the platform of the version
                    string platform = //platform

                    if (curent version = certain type)
                    {   
                        //do what is required.
                        //build a list
                    }
                    else
                    {
                        //normal routine
                        //do what is required
                        //build a list
                    }

                    //populating the panel with data from list

                        createflavourheader(a);
                        //create dynamic checkboxes according to the list

                     foreach(string s in list)
                     //createrow parameter is by version type and platform
                             createfilerow(readin, path, true, true, false, false);

                    }
                }
            }
            form1.Controls.Add(Panel2);
        }    

Sorry can’t show you the full code as it is long and I believe it should be confidential even though i wrote them all

  • 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-10T00:12:06+00:00Added an answer on June 10, 2026 at 12:12 am

    Yes you can access, Below is an example

     // On Page1.aspx I have a button for postback
      <asp:Button ID="btnSubmit" runat="server" Text="Submit" 
         PostBackUrl="~/Page2.aspx" />
    
     // Page1.aspx.cs 
     protected void Page_Load(object sender, EventArgs e)
     {
        TextBox t = new TextBox(); // created a TextBox
        t.ID = "myTextBox";        // assigned an ID
        form1.Controls.Add(t);     // Add to form
    
    }
    

    Now on the second page I will get the value of TextBox as

     // Page2.aspx.cs
     protected void Page_Load(object sender, EventArgs e)
     {       
        if (PreviousPage != null)
        {
            TextBox t = (TextBox) PreviousPage.FindControl("myTextBox");
            string mytboxvalue = t.Text;
        }
                            // OR
        string myTextBoxValue = Request.Form["myTextBox"];
     }
    

    Updated Answer:

      Panel myPanel = new Panel();
        myPanel.ID = "myPanel";
    
        TextBox t = new TextBox();
        t.ID = "myTextBox";
        myPanel.Controls.Add(t);
    
        TextBox t1 = new TextBox();
        t1.ID = "myTextBox1";
        myPanel.Controls.Add(t1);
    
        // Add all your child controls to your panel and at the end add your panel to your form
        form1.Controls.Add(myPanel);
    
       // on the processing page you can get the values as
      protected void Page_Load(object sender, EventArgs e)
      {
    
        if (PreviousPage != null)
        {
            TextBox t = (TextBox) PreviousPage.FindControl("myTextBox");
            string mytboxvalue = t.Text;
        }
    
        string myTextBoxValue = Request.Form["myTextBox1"];
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I would like to count the length of a string with PHP. The string
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.