Narendra Sharma
Narendra Sharma

Reputation: 682

Error occurring in onclick event

The error in browser its showing like this ASP.student_aspxstudentdashboard_aspx' does not contain a definition for 'btnBindCourseData_OnClick'

and

no extension method 'btnBindCourseData_OnClick' accepting a first argument of type 'ASP.student_aspxstudentdashboard_aspx' could be found (are you missing a using directive or an assembly reference?)

and help in how to use repeater.

and my code is

<asp:Button ID="btnBindCourseData" runat="server" Text="Bind" OnClick="btnBindCourseData_OnClick" />
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
    <asp:Repeater ID="repeater1" runat="server">
        <HeaderTemplate>
        </HeaderTemplate>
        <ItemTemplate>
            <asp:Label ID="lblCertificateCourseName" runat="server" Text='<%#Eval("CourseName") %>' Font-Bold="true"></asp:Label>
            <asp:HiddenField ID="hfUnitInfoCourseID" runat="server" Value='<%#Eval("IdCourse") %>' />
        </ItemTemplate>
    </asp:Repeater>
</div>



 protected void btnBindCourseData_OnClick(object sender, EventArgs e)
    {

        UnitBLL objUnitBll = new UnitBLL();
        List<CourseMasterDTO> lstCourseMaster = new List<CourseMasterDTO>();

        lstCourseMaster = objUnitBll.bindCourseData();

        Repeater repeater1 = (Repeater)Master.FindControl("repeater1");

    }

Upvotes: 1

Views: 85

Answers (2)

Aayushi Jain
Aayushi Jain

Reputation: 2879

Rewrite your C# code, try by pasting the following code. C# is case-sensitive.

void btnBindCourseData_OnClick(Object sender,EventArgs e)
{
    UnitBLL objUnitBll = new UnitBLL();
    List<CourseMasterDTO> lstCourseMaster = new List<CourseMasterDTO>();
    lstCourseMaster = objUnitBll.bindCourseData();
    Repeater repeater1 = (Repeater)Master.FindControl("repeater1");
}

Upvotes: 1

Chiragkumar Thakar
Chiragkumar Thakar

Reputation: 3726

I think you should rebuild your code once and have to check again, or remove the event from button click and regenerate it again, it happened to me, might work for you.

Upvotes: 1

Related Questions