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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:15:05+00:00 2026-06-15T18:15:05+00:00

All of this happens within the same user control so that shouldnt make a

  • 0

All of this happens within the same user control so that shouldnt make a difference.

<asp:Repeater ID="rptActivity" runat="server" OnItemCreated="rptActivity_ItemCreated">
    <ItemTemplate>
        <div class="under-label">
            <div class="activity">
                <%#Eval("ActivityName")%>
                <input type="hidden" name="activityId" value='<%#Eval("ActivityId")%>' />
            </div>

            <div class="status">
                <asp:DropDownList ID="ddlStatuses" DataSourceID="SqlDataSource1"  DataTextField="Name" DataValueField="Id"  runat="server"></asp:DropDownList>
            </div>
            <div class="comment">
                <textarea name="comments" cols="35" rows="3" name="comment" style="float: left; margin: 0px 0px 0px 25px; font-family: Geneva, Arial, Helvetica, sans-serif;"><%#Eval("Comment")%></textarea>
            </div>
        </div>
    </ItemTemplate>
</asp:Repeater>

The i have the following code in the repeater’s itemcreated event:

 protected void rptActivity_ItemCreated(object sender, RepeaterItemEventArgs e)
        {
            var helper = (UpdateActivitiesHelper)e.Item.DataItem;

            DropDownList ddl = (DropDownList)FindControl("ddlStatuses");
            ddl.SelectedValue = helper.StatusId.ToString();
        }

and when i try to use ddl it throws NullReferenceException.

Any ideas?

  • 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-15T18:15:07+00:00Added an answer on June 15, 2026 at 6:15 pm

    Since your drop down list is inside the repeater, make sure you reference the DataItem to find the control.

    Make sure to use e.Item.FindControl rather than Page.FindControl — Page.FindControl will not find this item because it will not recursively search the page

    protected void rptActivity_ItemCreated(object sender, RepeaterItemEventArgs e)
    {
        var helper = (UpdateActivitiesHelper)e.Item.DataItem;
        DropDownList ddl = (DropDownList)e.Item.FindControl("ddlStatuses");
        ddl.SelectedValue = helper.StatusId.ToString();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this annoying problem, that Im pretty sure happens to all of you
first of all: this is not the same as this . The ModelBackend has
I have some simple JavaScript that determines where a click happens within a browser
I would like to make sure that when user log in it will stay
This took me by surprise… Seems that you can’t use the same name for
This doesn't happen all the time. A bug is not a bug if cannot
This seems to happen all the time to me: I work on the parent
it is very strange, because this error doesn't happen all the time... I have
Hi all this is my xml file with xsd defined as internal to it
hello all this seems to be my problem I have a table in mysql

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.