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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:05:44+00:00 2026-06-12T19:05:44+00:00

I am using an OnItemDataBound event to attempt to activate a disabled button in

  • 0

I am using an OnItemDataBound event to attempt to activate a disabled button in a repeater. Quite simply, if the event is triggered, I know there are items in the repeater and therefore want to enable the button. Where I am getting stuck is on casting the button in the function so I can enable it. The relevant part of the repeater code is below:

<asp:Repeater ID="RptEnterHours" runat="server" DataSourceID="SQL_EmployeeGetTimesheet" ClientIDMode="Predictable" OnItemDataBound="RptEnterHours_Bound">
     '.....Irrelevant code.....
     <FooterTemplate>
          <asp:Button Enabled="false" ID="SubmitTimesheets" Text="Submit All Timesheets" OnClick="processTimesheetEntry" runat="server" OnClientClick="checkValues();" />&nbsp;
     </FooterTemplate>
</asp:Repeater>

This is my code behind:

Sub RptEnterHours_Bound(Sender As Object, e As RepeaterItemEventArgs)

    'Exposes the Submit All Timesheets button if timesheets are available.
    If (e.Item.ItemType = ListItemType.Item) Or _
        (e.Item.ItemType = ListItemType.AlternatingItem) Then
        Dim sButton As Button = TryCast(Me.FindControl("SubmitTimesheets"), Button)
        sButton.Enabled = True
    End If

End Sub

This and all other attempts has yielded the dreaded “Object reference not set to an instance of an object” message. Can anyone tell me what I am doing wrong and why my code behind won’t find the button?

  • 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-12T19:05:46+00:00Added an answer on June 12, 2026 at 7:05 pm

    please try this i am sure it will help you.

        If e.Item.ItemType = ListItemType.Footer Then
            Dim btn as new button
            btn = CType(e.Item.FindControl("SubmitTimesheets"), Button)
            btn.enabled = true
        End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A table row is generated using an asp:Repeater: <asp:repeater ID=announcementsRepeater OnItemDataBound=announcementsRepeater_ItemDataBound runat=Server> <itemtemplate> <tr
Using VS 2008, I have a Repeater control: <asp:Repeater runat=server ID=storesRep DataSourceID=storeSqlDataSource OnItemDataBound=StoresRep_ItemDataBound> <ItemTemplate>
Using Telerik RadGrid I'm binding a datasource and attach a method to the OnItemDataBound
I am Uday Satardekar, In my nridubai.com website,i am editing Event Information using EditTemplate
I have a nested repeater with a delete button in it. This button deletes
Using android 2.3.3, I have a background Service which has a socket connection. There's
Using a repeater to data bind a common control we are having issues where
I have a repeater which dynamically generate tab links using Sitecore (sc:Link) like this:
I've added a div overlay to my repeater control using absolute positioning. Predicably, this
I have a repeater inside which i put a Checkbox and above rapeater there

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.