+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / compilation Error working with code behind

compilation Error working with code behind

3 posts, 0 answered
  1. Viren
    Viren avatar
    41 posts
    Registered:
    03 Aug 2010
    18 Oct 2010
    Link to this post
    Hi,

    I added an asp button to on my sitefinity template to implement a mailto functionality. I want to write the emailing client code in the code and I want to fire this event upon the button press. Here is what I did:

    <p><asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" /></p>

    In the code behind file of the template I wrote the following:

    protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //Logic to send email
        }
    When I try to load the template in sitefinity I get the following error:
    error CS1061: 'ASP.app_master_sample_master' does not contain a definition for 'btnSubmit_Click' and no extension method 'btnSubmit_Click' accepting a first argument of type 'ASP.app_master_sample_master' could be found (are you missing a using directive or an assembly reference?)

    I mean the method exists and why does the error say "....does not contain a definition for....". Am I missing a step here? Also I cannot access the controls defined inside the markup in the code behind file. For example, intellisense does not show me "btnSubmit" or any other such control when I try to access them inside the code behind. 
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    18 Oct 2010
    Link to this post
    Hi Viren,

    Try using the attached template. You could make the method only void.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Viren
    Viren avatar
    41 posts
    Registered:
    03 Aug 2010
    19 Oct 2010
    Link to this post
    Thanks. I will try that and write back here in this thread.
Register for webinar
3 posts, 0 answered