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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Problem with Autopostback

Problem with Autopostback

Scheduled Pinned Locked Moved ASP.NET
csharphelpasp-netvisual-studio
11 Posts 4 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.
  • M Offline
    M Offline
    mohd imran abdul aziz
    wrote on last edited by
    #1

    Dear All, I am making web application using Asp.net and C#(Visual Studio 2005). In one web page . i have made three controls Autopostback property true. Out of them two of them works fine. but I am having problem with third one. Is that one can use only two controls on a page whose autopostback true Please Help me.

    regards imran khan

    A S V 3 Replies Last reply
    0
    • M mohd imran abdul aziz

      Dear All, I am making web application using Asp.net and C#(Visual Studio 2005). In one web page . i have made three controls Autopostback property true. Out of them two of them works fine. but I am having problem with third one. Is that one can use only two controls on a page whose autopostback true Please Help me.

      regards imran khan

      A Offline
      A Offline
      Arindam Tewary
      wrote on last edited by
      #2

      There is no restriction on how many controls in your page can have AutoPostback="true". So something other is going wrong there. Arindam

      M 1 Reply Last reply
      0
      • A Arindam Tewary

        There is no restriction on how many controls in your page can have AutoPostback="true". So something other is going wrong there. Arindam

        M Offline
        M Offline
        mohd imran abdul aziz
        wrote on last edited by
        #3

        if postback is true then atleast it should go thrugh text_changed. but flow is not going through it . what cold be reason. please guide

        regards imran khan

        A 1 Reply Last reply
        0
        • M mohd imran abdul aziz

          if postback is true then atleast it should go thrugh text_changed. but flow is not going through it . what cold be reason. please guide

          regards imran khan

          A Offline
          A Offline
          Arindam Tewary
          wrote on last edited by
          #4

          What are the 3 controls you are having and which one is creating trouble to you? Arindam

          M 1 Reply Last reply
          0
          • A Arindam Tewary

            What are the 3 controls you are having and which one is creating trouble to you? Arindam

            M Offline
            M Offline
            mohd imran abdul aziz
            wrote on last edited by
            #5

            Thanks for quick reply Firh i am using Combo Box Control(Autopostback true). I wrote the following code which work fine(this code is to select service code and fetch from database corresponding max recordno and assign 1+ max record no to textbox1 ) protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e) { setting = ConfigurationManager.ConnectionStrings["Databaseconnection"]; if (setting != null) { SqlConnection conn = new SqlConnection(setting.ConnectionString); query = "select max(serialNO) from inquirydtl where serviceid = '" + DropDownList1.SelectedItem + "'"; SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); //TextBox1.Text = cmd.ExecuteScalar() + 1; int i; //SqlDataReader rdr = cmd.ExecuteReader(); if (cmd.ExecuteScalar().ToString().Equals("")) { TextBox1.Text = "000001"; } else { TextBox1.Text = cmd.ExecuteScalar().ToString(); } TextBox1.Focus(); } } Seond i am using Textbox(Autopostback) true .where i want to concatenate it with textbox1.text to generates inquiryid . check for its existnace but it does not work. In debug mode. flow does not go through it.even then i made corresponding TextBox1.AutoPostBack = true; in page load event what is problem. please help

            regards imran khan

            A 1 Reply Last reply
            0
            • M mohd imran abdul aziz

              Thanks for quick reply Firh i am using Combo Box Control(Autopostback true). I wrote the following code which work fine(this code is to select service code and fetch from database corresponding max recordno and assign 1+ max record no to textbox1 ) protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e) { setting = ConfigurationManager.ConnectionStrings["Databaseconnection"]; if (setting != null) { SqlConnection conn = new SqlConnection(setting.ConnectionString); query = "select max(serialNO) from inquirydtl where serviceid = '" + DropDownList1.SelectedItem + "'"; SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); //TextBox1.Text = cmd.ExecuteScalar() + 1; int i; //SqlDataReader rdr = cmd.ExecuteReader(); if (cmd.ExecuteScalar().ToString().Equals("")) { TextBox1.Text = "000001"; } else { TextBox1.Text = cmd.ExecuteScalar().ToString(); } TextBox1.Focus(); } } Seond i am using Textbox(Autopostback) true .where i want to concatenate it with textbox1.text to generates inquiryid . check for its existnace but it does not work. In debug mode. flow does not go through it.even then i made corresponding TextBox1.AutoPostBack = true; in page load event what is problem. please help

              regards imran khan

              A Offline
              A Offline
              Arindam Tewary
              wrote on last edited by
              #6

              The main point lies what I feel the way TextBox autopostback event reacts. Basically a control can do a autopostback in 3 scenario 1. Ater entering all the character in textbox, if ENTER key is pressed. 2. Ater entering all the character in textbox, if TAB key is pressed. 3. Ater entering all the character in textbox, click anywhere outside of the Textbox. Like drop down list TextBox cant just fire server side textchangedevent as you keep entering character from keyboard one by one. If you do the same it becomes a client side event that can be tracked using anyclientside event.( onkeypress, onkeydown ... like that) So make sure that you are initiating the postback event of the Textbox, means you are performing either of the above mentioned activities. Hope it will help you. :) Arindam

              M 1 Reply Last reply
              0
              • A Arindam Tewary

                The main point lies what I feel the way TextBox autopostback event reacts. Basically a control can do a autopostback in 3 scenario 1. Ater entering all the character in textbox, if ENTER key is pressed. 2. Ater entering all the character in textbox, if TAB key is pressed. 3. Ater entering all the character in textbox, click anywhere outside of the Textbox. Like drop down list TextBox cant just fire server side textchangedevent as you keep entering character from keyboard one by one. If you do the same it becomes a client side event that can be tracked using anyclientside event.( onkeypress, onkeydown ... like that) So make sure that you are initiating the postback event of the Textbox, means you are performing either of the above mentioned activities. Hope it will help you. :) Arindam

                M Offline
                M Offline
                mohd imran abdul aziz
                wrote on last edited by
                #7

                thanks Arindam, I think that i am just assainging database value(Not entering) to textbox that cuases problem. How can i make sure that even i assaign from database. code execute. please guide me thanks once againe

                regards imran khan

                A 1 Reply Last reply
                0
                • M mohd imran abdul aziz

                  thanks Arindam, I think that i am just assainging database value(Not entering) to textbox that cuases problem. How can i make sure that even i assaign from database. code execute. please guide me thanks once againe

                  regards imran khan

                  A Offline
                  A Offline
                  Arindam Tewary
                  wrote on last edited by
                  #8

                  I didnt get what exactly you want to do. Mathod TextBox1_TextChanged(....) event handler only starts executing if those condition is satisfied. Just a suggestion. You can put your code( whatever you are writing inside TextBox1_TextChanged(....) ) just after populating the textbox values from database. Arindam,

                  M 1 Reply Last reply
                  0
                  • A Arindam Tewary

                    I didnt get what exactly you want to do. Mathod TextBox1_TextChanged(....) event handler only starts executing if those condition is satisfied. Just a suggestion. You can put your code( whatever you are writing inside TextBox1_TextChanged(....) ) just after populating the textbox values from database. Arindam,

                    M Offline
                    M Offline
                    mohd imran abdul aziz
                    wrote on last edited by
                    #9

                    hi, no,I wrote dropdownlist select event to get service id and fetch from database max of corresponing serial no. which i populate in textbox. now based on textbox text. i concatenate both field to create one inquiry id and checkfor it existance. for tha same i wrote code in textbox change event. but it does not fire as i fetching value from database.Now i am checking inquiry existance code on button. Is there any alternate so that user do not need to click button.

                    regards imran khan

                    1 Reply Last reply
                    0
                    • M mohd imran abdul aziz

                      Dear All, I am making web application using Asp.net and C#(Visual Studio 2005). In one web page . i have made three controls Autopostback property true. Out of them two of them works fine. but I am having problem with third one. Is that one can use only two controls on a page whose autopostback true Please Help me.

                      regards imran khan

                      S Offline
                      S Offline
                      siddu786
                      wrote on last edited by
                      #10

                      Hai Take One CompareField Validator and go to propeties 1.Type= integer 2.Operator= DataTypeChecking. Happy Coding

                      Siddu Software Developer

                      1 Reply Last reply
                      0
                      • M mohd imran abdul aziz

                        Dear All, I am making web application using Asp.net and C#(Visual Studio 2005). In one web page . i have made three controls Autopostback property true. Out of them two of them works fine. but I am having problem with third one. Is that one can use only two controls on a page whose autopostback true Please Help me.

                        regards imran khan

                        V Offline
                        V Offline
                        Vikram kshatriya
                        wrote on last edited by
                        #11

                        HI Imran, That is not the case and you can use any number of controls that have the AutoPostBack property "true".Could you explain me the exact scenario what you want to ask?

                        Vicky

                        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