tags:

views:

212

answers:

2

I'm not able to locate the repeater controller called 'repScore' which is located inside the FormView controller.

This is my code:

<asp:FormView runat="server" id="fwHotelDetails" DataKeyNames="id" OnDataBound="fwHotelDetails_DataBound" >
    <ItemTemplate>
        // (..) some code here which outputs some data

        <asp:Repeater runat="server" id="repScore">
          <ItemTemplate>
            <span class="item"> <%# Eval("criteria") %>:</span>
          </ItemTemplate>
        </asp:Repeater>

    </ItemTemplate>
</asp:FormView>

And this is my code behind:

    protected void fwHotelDetails_DataBound(object sender, EventArgs e)
    {
        Repeater rep = (Repeater)fwHotelDetails.FindControl("repScore");

        rep.DataSource = this.dtCriteria;
        rep.DataBind();
    }

What am I doing wrong?

+1  A: 

I cannot see that formView raises the DataBound event, didn't you forget declare event handler?

Dewfy
You are absolutely right. So I have added OnDataBound="fwHotelDetails_DataBound". Now I get the following error message: CS1061: 'ASP.templates_hoteldetails_aspx' does not contain a definition for 'fwHotelDetails_DataBound' and no extension method 'fwHotelDetails_DataBound' accepting a first argument of type 'ASP.templates_hoteldetails_aspx' could be found (are you missing a using directive or an assembly reference?)
Steven
Thanks for your heads up. I got that errormessage because the function was set to private. Once I used Protected instead, it worked.
Steven
A: 

I can't comment yet... so here it goes:

basically it means it has no access to method you declared...

changing the "private" to "protected" (or "internal", or "public", depends on what you need) should help.

Mike Nowak