Problem with Autopostback
-
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
-
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
There is no restriction on how many controls in your page can have AutoPostback="true". So something other is going wrong there. Arindam
-
There is no restriction on how many controls in your page can have AutoPostback="true". So something other is going wrong there. Arindam
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
-
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
What are the 3 controls you are having and which one is creating trouble to you? Arindam
-
What are the 3 controls you are having and which one is creating trouble to you? Arindam
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
-
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
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
-
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
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
-
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
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,
-
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,
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
-
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
-
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
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