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 7696589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:48:57+00:00 2026-05-31T21:48:57+00:00

im trying to do somthing and got into a problem. i got a function

  • 0

im trying to do somthing and got into a problem.

i got a function that adding html elements and thire attributes.
now, i want to get the controls in server side (code behind) so i can do some stuff with them.

my problem is:
i cant “find” them.

this is part of the function im using to add them, its a bit longer so i show only the controls i want to get in the server side:

 public string EditPhoto(int x)
{
    using (StringWriter stringWriter = new StringWriter())
    {
        using (HtmlTextWriter writer = new HtmlTextWriter(stringWriter))
        {
            // Some strings for the attributes.
           string classValue = "thumb";

            //Begin #5 <div class=image-title">
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "image-title");
            writer.AddAttribute("runat", "server"); //--> server side att
            writer.AddAttribute(HtmlTextWriterAttribute.Id, "title" + x);
            writer.RenderBeginTag(HtmlTextWriterTag.Input);
            TextWriter innerTextWriter = writer.InnerWriter;
            innerTextWriter.Write(title);
            writer.RenderEndTag(); //#End 5 </div>


            //Begin #6 <div class="image-desc">
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "image-desc");
            writer.AddAttribute("runat", "server"); //--> server side att
            writer.AddAttribute(HtmlTextWriterAttribute.Id, "desc" + x);
            writer.RenderBeginTag(HtmlTextWriterTag.Input);
            innerTextWriter = writer.InnerWriter;
            innerTextWriter.Write(descreption);
            writer.RenderEndTag(); //#End 6 </div>

            writer.RenderEndTag();//#End 4 </div>
            writer.RenderEndTag(); // End #1 </li>

        }
        // Return the result.
        return stringWriter.ToString();
    }

afther the function is done i got this Test code to try and look for them:

for (int i = 0; i < Controls.Count; i++)
    {

    if (FindControl("title" + i) != null)
        Response.Write("Found 1 title control");
    else
        Response.Write( i +"There is no control");
    }

        for (int i = 0; i < Controls.Count; i++)
        {

            if (FindControl("desc" + i) != null)
                Response.Write("Found 1 descreption control");
            else
                Response.Write(i + "Thre is no control");
        }

sorry for my english

  • 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-05-31T21:48:58+00:00Added an answer on May 31, 2026 at 9:48 pm

    Check it dude….

    You’d have some sort of container in your aspx, like this:

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

    Then in your code behind you could have something like this:

        protected void Page_Load(object sender, EventArgs e)
        {
            InsertControls();
        }
    
        private void InsertControls()
        {
            TextBox textBox = new TextBox();
            textBox.ID = "textBox1";
            textBox.Text = "Cool Beans";
    
            controlPanel.Controls.Add(textBox);
    
            TextBox locatedTextBox = TraverseControlTree(controlPanel, "textBox1") as TextBox;
        }
    
        public static Control TraverseControlTree(Control root, string Id)
        {
            if (root.ID == Id) { return root; }
    
            foreach (Control Ctl in root.Controls)
            {
                Control control = TraverseControlTree(Ctl, Id);
                if (control != null) { return control; }
            }
    
            return null;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In trying to implement the repository pattern I've run into a minor problem that
I've got into a rather simple, yet annoying problem. I'm trying to create a
I've got a strange problem with a php file. I'm trying to get some
I've got a Roo generated webapp that I'm trying to put JQuery into (I
I'm trying to write a function that accepts a certain type or any of
I'm trying to add a feature into my app that allows the user to
My problem is that I'm trying to add a child entity, but keep running
Let's say I've got a table that I'm trying to convert. Its got column
Hey, I've got a question about general member function pointers. I'm trying to achieve
I am trying to integrate Facebook into a web app that I am working

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.