Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Event not firing

Event not firing

Scheduled Pinned Locked Moved ASP.NET
questionsysadminhelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kasic Slobodan
    wrote on last edited by
    #1

    I have a UC for editing users (EditUsers.ascx). The data is loaded into EditUsers.ascx with (plain) AJAX. EdiUsers.ascx consists of editing form, close btn and submit button (Save)... Because I have three different types of users (with small differences between them), I have copied (to save time) the code from one UC to another and set it to be special to that type of users. I have created (double click) event handler for Save button:

    <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" />

    And in code behind:

    protected void btnSave_Click(object sender, EventArgs e)
    {
    // Call the save function....
    }

    And this doesn't seem to work... I submit a form and nothing happens, no save function call. I also tried this:

    protected override void OnInit(EventArgs e)
    {
    btnSave.Click += new EventHandler(btnSave_Click);

    //base.OnInit(e);
    

    }

    protected void btnSave_Click(object sender, EventArgs e)
    {
    // Call the save function....
    }

    And this doesn't work either. Can anyone tell me what is the problem and am I missing something?

    R 1 Reply Last reply
    0
    • K Kasic Slobodan

      I have a UC for editing users (EditUsers.ascx). The data is loaded into EditUsers.ascx with (plain) AJAX. EdiUsers.ascx consists of editing form, close btn and submit button (Save)... Because I have three different types of users (with small differences between them), I have copied (to save time) the code from one UC to another and set it to be special to that type of users. I have created (double click) event handler for Save button:

      <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" />

      And in code behind:

      protected void btnSave_Click(object sender, EventArgs e)
      {
      // Call the save function....
      }

      And this doesn't seem to work... I submit a form and nothing happens, no save function call. I also tried this:

      protected override void OnInit(EventArgs e)
      {
      btnSave.Click += new EventHandler(btnSave_Click);

      //base.OnInit(e);
      

      }

      protected void btnSave_Click(object sender, EventArgs e)
      {
      // Call the save function....
      }

      And this doesn't work either. Can anyone tell me what is the problem and am I missing something?

      R Offline
      R Offline
      reza toorani
      wrote on last edited by
      #2

      Checked <%@Page CodeFile="" Inherits="" %> ,maybe these properties don't correct.

      K 2 Replies Last reply
      0
      • R reza toorani

        Checked <%@Page CodeFile="" Inherits="" %> ,maybe these properties don't correct.

        K Offline
        K Offline
        Kasic Slobodan
        wrote on last edited by
        #3

        VS.net has generated this and I didn't modify this and namespace is ePoslovi.Module and EditUsers is a class inherited from UserControl how it should be.

        <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EditUsers.ascx.cs" Inherits="ePoslovi.Module.EditUsers" %>

        Any clue?

        1 Reply Last reply
        0
        • R reza toorani

          Checked <%@Page CodeFile="" Inherits="" %> ,maybe these properties don't correct.

          K Offline
          K Offline
          Kasic Slobodan
          wrote on last edited by
          #4

          Debugger says that, when I click on submit button, Page.IsPostBack is false?! Hows that possible? I even add a new button, and tried with it and same thing.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups