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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:39:20+00:00 2026-05-30T10:39:20+00:00

im doing some test with the flicker API and i got a wierd problem

  • 0

im doing some test with the flicker API and i got a wierd problem afther i changed some controls in my code.

when i first tried to requst images i stored them in a Image and every thing work great but i want to do other stuff to the image so i tried using ImageButton class and i get an exception that it got to have run=”server” property.

i adding all the controls programmticly.

what is wierd for me is that the class Image didnt gave any excpetion but using a class that inherit from him did.

so my qustion is: it possibly to add and check if the control have the runat=”server” property via c# code?

(sorry for my english)

here is some of my code:

 protected void Page_Load(object sender, EventArgs e)
{

    string key = "*****************";
    string secret = "***********";
    MyFlicker myFlicker = new MyFlicker(key, secret);
    int photoCount = myFlicker.coll.Count;
    try
    {
        string[] urls = myFlicker.GetPhotosURLS();
        string[] desc = myFlicker.GetPhotosDescreptions();
        string[] Titels = myFlicker.GetPhotosTitle();

        Panel[] panels = new Panel[photoCount];
        ImageButton[] images = new ImageButton[photoCount];
        Label[] descreptions = new Label[photoCount];
        Label[] titles = new Label[photoCount];

        for (int i = 0; i < photoCount; i++)
        {
            panels[i] = new Panel();
            images[i] = new ImageButton();
            descreptions[i] = new Label();
            titles[i] = new Label();


            titles[i].Text = Titels[i] + ":כותרת התמונה";
            images[i].ImageUrl = urls[i];

            if (descreptions[i] != null)
                descreptions[i].Text ="תיאור התמונה: " + desc[i];
            else
                descreptions[i].Text = "descreption was not found!";

            panels[i].ID = "panel" + i;
            images[i].ID = "image" + i;
            descreptions[i].ID = "des" + i;
            titles[i].ID = "titles" + i;

            panels[i].Controls.Add((Label)titles[i]);
            panels[i].Controls.Add((Label)descreptions[i]);
            panels[i].Controls.Add((Image)images[i]);
            this.Controls.Add((Panel)panels[i]);




        }


    }

    catch (Exception ex)
    {
        Response.Write(ex.Message);
    }



}

here is the apsx:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Copy_of_galleryControlTest_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

</head>
<body>
    <form id="form1" runat="server">
    <div>
    </div>
    </form>
</body>
</html>
  • 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-30T10:39:22+00:00Added an answer on May 30, 2026 at 10:39 am

    After doing a test similar to this code, I got this error

    Control ‘ctl03’ of type ‘ImageButton’ must be placed inside a form tag
    with runat=server.

    then I changed from

    this.Controls.Add((Panel)panels[i]);
    

    to

    form1.Controls.Add((Panel)panels[i]);
    

    And it makes sense now.. ImageButton is a submit control ( a control which would submit the form), so this why this error, the control needd to be a child of the form1 and not outside it

    Another workaround is to override this method, but I recommend the first one

    public override void VerifyRenderingInServerForm(Control control)
    {
        ;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

so i was doing some algorithm solving problems and the first questions input/output test
after doing some test-code for this link : Is it safe to call temporary
Are you doing test first anyway? Or in some cases you are doing some
I have been looking in to doing some test driven development for one of
I have been doing some research on test driven development and find it pretty
I am doing some simple sanity validation on various types. The current test I'm
I'm new in Silverlight and i am doing some tests. With my current test
Doing some 3D stuff in wpf- want to use a simpler test to see
I am doing some sort of lab test record collection but there is a
I'm doing some file io and created the test below, but I thought testoutput2.txt

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.