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. The function gets Fired Twice why ?

The function gets Fired Twice why ?

Scheduled Pinned Locked Moved ASP.NET
designquestion
4 Posts 3 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.
  • V Offline
    V Offline
    Vimalsoft Pty Ltd
    wrote on last edited by
    #1

    Good Day All i have a function that is getting called with Pagemethods like this

    protected void Bind\_SearchBox(object sender, EventArgs e)
    {
        
            RadToolBarItem textItem = RadToolBar1.FindItemByText("Button1");
            TextBox txtseach = (TextBox)textItem.FindControl("txtsearch");
            try
            {
                if (sender.Equals(txtseach))
                {
                    Bind\_SearchBox(txtseach.Text);
                }
            }
            catch (SqlException ex)
            {
                lblMessage.Text = ex.Message;
                Response.Redirect("View.aspx", false);
            }
        
    }
    

    and this method will call this

    /// <summary>
    /// This Function will bind the ListBoxes on the Lefthand side of the Viewer
    /// It accept a search String
    /// </summary>
    public void Bind_SearchBox(String Search)
    {
    Session["Search"] = Search;

        RadPanelBar1.Items.Clear();
    
        RadScheduler1.Appointments.Clear();
        //get the Menu inside the toolbar
        RadToolBarItem textItem = RadToolBar1.FindItemByText("Button1");
        RadMenu RadMenu1 = (RadMenu)textItem.FindControl("RadMenu1");
    
    
        ViewerService.ViewerService obj = new ViewerService.ViewerService();
    
        String SessionKey = obj.newSession();
    
        DateTime Date1 = Convert.ToDateTime("1980-01-01");
    
        DateTime Date2 = Convert.ToDateTime("2012-12-31");
    
        List<string> ParentRecordsRow = new List<string>();
    
        List<string> ChildRecordsField = new List<string>();
    
        ViewerService.extract extract = obj.getObjects(SessionKey, Search, Date1, false, Date2, false, "", "");
    
        try
        {
            int Len = extract.set.Length;
            for (int i = 0; i < Len; i++)
            {
                ViewerService.vertex value = extract.set\[i\];//Row
                 
                String PanelClass = value.meta;
                PanelClass = PanelClass.Replace(Remstr, "");
                PanelClass = PanelClass.Replace(Remstr2, "");
                Appointment app = null;
                if (value.atom != null)
                {
    
                    RadPanelItem pane = RadPanelBar1.Items.FindItemByText(PanelClass);
                    if (pane == null)
                    {
                        RadPanelItem nwpane = new Telerik.Web.UI.RadPanelItem(PanelClass);
                        R
    
    F 1 Reply Last reply
    0
    • V Vimalsoft Pty Ltd

      Good Day All i have a function that is getting called with Pagemethods like this

      protected void Bind\_SearchBox(object sender, EventArgs e)
      {
          
              RadToolBarItem textItem = RadToolBar1.FindItemByText("Button1");
              TextBox txtseach = (TextBox)textItem.FindControl("txtsearch");
              try
              {
                  if (sender.Equals(txtseach))
                  {
                      Bind\_SearchBox(txtseach.Text);
                  }
              }
              catch (SqlException ex)
              {
                  lblMessage.Text = ex.Message;
                  Response.Redirect("View.aspx", false);
              }
          
      }
      

      and this method will call this

      /// <summary>
      /// This Function will bind the ListBoxes on the Lefthand side of the Viewer
      /// It accept a search String
      /// </summary>
      public void Bind_SearchBox(String Search)
      {
      Session["Search"] = Search;

          RadPanelBar1.Items.Clear();
      
          RadScheduler1.Appointments.Clear();
          //get the Menu inside the toolbar
          RadToolBarItem textItem = RadToolBar1.FindItemByText("Button1");
          RadMenu RadMenu1 = (RadMenu)textItem.FindControl("RadMenu1");
      
      
          ViewerService.ViewerService obj = new ViewerService.ViewerService();
      
          String SessionKey = obj.newSession();
      
          DateTime Date1 = Convert.ToDateTime("1980-01-01");
      
          DateTime Date2 = Convert.ToDateTime("2012-12-31");
      
          List<string> ParentRecordsRow = new List<string>();
      
          List<string> ChildRecordsField = new List<string>();
      
          ViewerService.extract extract = obj.getObjects(SessionKey, Search, Date1, false, Date2, false, "", "");
      
          try
          {
              int Len = extract.set.Length;
              for (int i = 0; i < Len; i++)
              {
                  ViewerService.vertex value = extract.set\[i\];//Row
                   
                  String PanelClass = value.meta;
                  PanelClass = PanelClass.Replace(Remstr, "");
                  PanelClass = PanelClass.Replace(Remstr2, "");
                  Appointment app = null;
                  if (value.atom != null)
                  {
      
                      RadPanelItem pane = RadPanelBar1.Items.FindItemByText(PanelClass);
                      if (pane == null)
                      {
                          RadPanelItem nwpane = new Telerik.Web.UI.RadPanelItem(PanelClass);
                          R
      
      F Offline
      F Offline
      Fayu
      wrote on last edited by
      #2

      Just a thought, are you calling this method on Page_Load?

      V 1 Reply Last reply
      0
      • F Fayu

        Just a thought, are you calling this method on Page_Load?

        V Offline
        V Offline
        Vimalsoft Pty Ltd
        wrote on last edited by
        #3

        i am Calling the Function when the user presses enter , here is the markup

        Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

        J 1 Reply Last reply
        0
        • V Vimalsoft Pty Ltd

          i am Calling the Function when the user presses enter , here is the markup

          Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

          J Offline
          J Offline
          JV9999
          wrote on last edited by
          #4

          Remove the OnTextChanged attribute. That probably causes the second fire.

          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