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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:03:52+00:00 2026-06-01T08:03:52+00:00

I’m using an ObjectDataSource to bind an object to a GridView. In the OnRowDataBound

  • 0

I’m using an ObjectDataSource to bind an object to a GridView. In the OnRowDataBound event handler I’m trying to determine if a certain button should be visible or not. When the runtime encounters this statement it fires an “No default member found for type ‘Pledge’.” error:

lbDel.Visible = Not (e.Row.DataItem("BillingReady"))

My Object class that is bound to the GridView:

public class Pledges : System.Collections.CollectionBase
{
    public Pledge this[int index]
    {
        get { return ((Pledge)(List[index])); }
        set { List[index] = value; }
    }

    public int Add(Pledge pledge)
    {
        return List.Add(pledge);
    }
}

My Pledge class:

public class Pledge
{
    public int PledgeID { get; set; }
    public int EventID { get; set; }
    public int SponsorID { get; set; }
    public int StudentID { get; set; }
    public decimal Amount { get; set; }
    public string Type { get; set; }
    public bool IsPaid { get; set; }
    public string EventName { get; set; }
    public DateTime EventDate { get; set; }
    public bool BillingReady { get; set; }
    public string SponsorName { get; set; }
    public int Grade_level { get; set; }
    public string StudentName { get; set; }
    public string NickName { get; set; }
    public int Laps { get; set; }
    public decimal PledgeSubtotal { get; set; }
}

My OnRowDataBound event handler:

Protected Sub PledgeGrid_OnRowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
    If (e.Row.RowType = DataControlRowType.DataRow) And _
      Not ((e.Row.RowState = DataControlRowState.Edit) Or ((e.Row.RowState = DataControlRowState.Alternate) And (e.Row.RowState = DataControlRowState.Edit))) Then
        Dim lbDel As LinkButton
        Dim lbEd As LinkButton
        lbDel = CType(e.Row.FindControl("lbDelete"), LinkButton)
        lbEd = CType(e.Row.FindControl("lbEdit"), LinkButton)

        If ((e.Row.RowState = DataControlRowState.Normal) Or (e.Row.RowState = DataControlRowState.Alternate)) Then
            lbDel.Visible = Not (e.Row.DataItem("BillingReady"))    '<-- Problem happens here
            lbEd.Visible = Not (e.Row.DataItem("BillingReady"))
        End If
    End If
End Sub

Yes, I’m having to mix VB and C# but I don’t think that’s the problem. If I understand the C# equivalent of a VB Default Property is called an indexer. Shouldn’t this qualify as an indexer?

public Pledge this[int index]
{
    get { return ((Pledge)(List[index])); }
    set { List[index] = value; }
}
  • 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-01T08:03:54+00:00Added an answer on June 1, 2026 at 8:03 am

    Try to cast the DataItem to Pledge:

    Dim pledge = DirectCast(e.Row.DataItem, Pledge)
    lbDel.Visible = Not pledge.BillingReady
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words

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.