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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:17:22+00:00 2026-05-27T09:17:22+00:00

After adding a control in the dayrender event, is there a way to find

  • 0

After adding a control in the dayrender event, is there a way to find the control later? I have tried

calendar.FindControl("lblSample")

but without success.

Here is some of my code to be more clear:

protected void calSample_DayRender(object sender, DayRenderEventArgs e)
{
    Label lblSample = new Label();
    lblSample.ID = "lblSample";
    lblSample.Text = "Sample";
    e.Cell.Controls.Add(lblSample);
}

After the day render event and the page loads completely, I have a link button event where I try and get the control back

protected void lbtnSave_Click(object sender, EventArgs e)
{
    //Not working
    Label lblSample = calSample.FindControl(lblSample);

    //Also can't get to work, this was using Ross' suggestion and the recursive find function he wrote about. I'm probably just not using it correctly.
    Label lblSample = ControlFinder.FindControl<Label>(calSample, "lblSample");
}
  • 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-27T09:17:22+00:00Added an answer on May 27, 2026 at 9:17 am

    This answer is because of Ross’ comment above showing me that I could use the Page.Request.Params to find the value I was after. It’s not the cleanest solution but it works!

    If you add a dropdownlist to a calendar control in the day render event

        protected void calSample_DayRender(object sender, DayRenderEventArgs e)
        {
            DropDownList ddlSample = new DropDownList();
            ddlSample.ID = "ddlSample";
            ddlSample.DataSource = sampleDS;
            ddlSample.DataBind();
            e.Cell.Controls.Add(ddlSample);
        }
    

    You can get the selected value back like this, of course I need to put in more checks to verify that the dropdownlist exists, but you get the picture

        protected void lbtnSave_Click(object sender, EventArgs e)
        {
            string sampleID = Page.Request.Params.GetValues("ddlSample")[0];
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way in VS2010 to keep a tool selected after adding the
I am adding user control to listbox. Everything works fine but i have a
I have a thumbnail control where I am adding Images using openfiledialog and after
I'm using aspxgridview and after adding operation by using RowInserting event and I don't
Does anyone know what the esiest way to update the entity model after adding/deleting
I have a basic page to which I'm adding an uploader control based on
I have a problem while writting event for ImageUpload User control. I want to
After configuring the webservice-server to support CORS by adding Header set Access-Control-Allow-Origin * to
I have a user control which is being loaded to the page dynamically after
I have a custom cell and i am adding a segment control to it.

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.