very funny well i did post the coding i just not want to execute the code on every post back any help will be highly appreciated
ShaikhAffi
Posts
-
how to avoid postbacks -
how to avoid postbacksHi all i have implemented a small application in which a button is placed named addRow when user clicks tht button a row is added in a grid view,whever user clicks it row will be added to the existing gridview i have done this with the following code now the problem is when i refresh the page the row is added or when i click any server control the row is also added bt i dont want this i just want the row shud be added when the button name addRow is clicked only. any help will be greatly appreciated.thanks in advance Code: ( cpp ) 1. protected void Page_Load(object sender, EventArgs e) 2. { 3. if (!Page.IsPostBack) 4. Session["dt"] = null; 5. 6. } 7. protected override void OnPreInit(EventArgs e) 8. { 9. base.OnPreInit(e); 10. if (Request.Form["hf"] == "true") 11. addGVRow(); 12. hf.Value = string.Empty; 13. } 14. 15. 16. private void addGVRow() 17. { 18. DataTable dt = (DataTable)Session["dt"]; 19. int counter = 0; 20. if (dt == null) 21. { 22. dt = new DataTable(); 23. dt.Columns.Add("seq"); 24. } 25. else 26. counter = dt.Rows.Count; 27. DataRow dr = dt.NewRow(); 28. dr[0] = counter + 1; 29. dt.Rows.Add(dr); 30. gv.DataSource = dt; 31. gv.DataBind(); 32. Session["dt"] = dt; 33. } and on aspx page for the button
-
Problem in post BackHi all i have implemented a small application in which a button is placed named addRow when user clicks tht button a row is added in a grid view,whever user clicks it row will be added to the existing gridview i have done this with the following code now the problem is when i refresh the page the row is added or when i click any server control the row is also added bt i dont want this i just want the row shud be added when the button name addRow is clicked only. any help will be greatly appreciated.thanks in advance Code: ( cpp ) 1. protected void Page_Load(object sender, EventArgs e) 2. { 3. if (!Page.IsPostBack) 4. Session["dt"] = null; 5. 6. } 7. protected override void OnPreInit(EventArgs e) 8. { 9. base.OnPreInit(e); 10. if (Request.Form["hf"] == "true") 11. addGVRow(); 12. hf.Value = string.Empty; 13. } 14. 15. 16. private void addGVRow() 17. { 18. DataTable dt = (DataTable)Session["dt"]; 19. int counter = 0; 20. if (dt == null) 21. { 22. dt = new DataTable(); 23. dt.Columns.Add("seq"); 24. } 25. else 26. counter = dt.Rows.Count; 27. DataRow dr = dt.NewRow(); 28. dr[0] = counter + 1; 29. dt.Rows.Add(dr); 30. gv.DataSource = dt; 31. gv.DataBind(); 32. Session["dt"] = dt; 33. } and on aspx page for the button
-
how to add row with checkboxes inside in table server control using c#please help me out well i done all these things by my self now the only problem remains is when i reload or refresh my page automatically row is inserted i dont want this please reply
-
getting client id of textbox in gridviewHi i have implemented a grid view in each there are certain textboxes and there is a button called popup besides first textbox of the row so what i want when i click this button it shud get the client id of first textbox in the row how can i achieve this any help will be greatly appreciated
-
how to get client id of textbox in gridviewHi i have implemented a grid view in each there are certaing textboxes and there is a button called popup besides first textbox of the row so what i want when i click this button it shud get the client id of first textbox in the row how can i achieve this any help will be greatly appreciated
-
how to add row with checkboxes inside in table server control using c#the second problem is as i told u i have a textbox named item there is a button besides tht textbox on each row when i click tht button a pop up shud be open well i opened the pop through the javascript now i want to pass the client id of tht textbox i mean item to tht javascript function which is calling the pop.so plz help me out this problem is driving me crazy any help wud greatly be appreciated i will wait for ur reply u have solved my prob until now this is the last problem plz do me favour thank u very much
-
how to add row with checkboxes inside in table server control using c#i have checked hf and gv already exist in the page it gives the same error i told u wht shud i do
-
how to add row with checkboxes inside in table server control using c#Salams ur code is giving problem when im using in page tht is using a master page sometimes it gives this error ystem.NullReferenceException: Object reference not set to an instance of an object. Source Error: Line 28: Line 29: Line 30: hf.Value = string.Empty; Line 31: Line 32: Source File: f:\erpSite\erp2\test.aspx.cs Line: 30 and onother time it gives this error System.NullReferenceException: Object reference not set to an instance of an object. Source Error: Line 47: dr[0] = counter + 1; Line 48: dt.Rows.Add(dr); Line 49: gv.DataSource = dt; Line 50: gv.DataBind(); Line 51: Session["dt"] = dt; Source File: f:\erpSite\erp2\test.aspx.cs Line: 49
-
how to add row with checkboxes inside in table server control using c#thank u very much and wht if i want to display serial no as well and i can delete the row. i want delete button on each row so whenever i press it that row shud be deleted well i can add delete button but i dont know the logic any help will be greatly appreciated. thank
-
how to add row with checkboxes inside in table server control using c#on page load i just equals the session table to null now the problem is solved bt how can i access the each textbox in grid view well thank u very much i w8 for ur reply
-
how to add row with checkboxes inside in table server control using c#well SA Bhatti i tried ur code the prob is u have implemented the session table tht i dont want coz if u will use session table then probably when u come back to tht page it will insert the last no: of rows
-
how to add row with checkboxes inside in table server control using c#well im working on an application for my father's buisness he has whole sale shop so whn a customer comes he may purchase items obviously he can purchase more than one time so im developing cash memo in tht cash memo ther are four textboxes for the itemName quantity saleprice and total and there is one button name addMoreItem so wht i want when user clicks this button same row of four textboxes shud b added every time user clicks row with the textboxes shud be added.after submitting the form whole data has to be saved in database the problem as i already told u is im unable to dynamically add row in table. hope u understand
-
how to add row with checkboxes inside in table server control using c#Actual SA Bhati i need to add row in table server control not in datagrid i nedd to add row in existing table the row shud contain atleas 4 to 5 textboxes hope u understood well thank u very much for the help
-
how to add row with checkboxes inside in table server control using c#Well Thank u very much for ur reply bt i this solution wont b suitable for my prob coz in each row i have atleast 5 textboxes so it will make the problem complecated what do u think
-
how to add row with checkboxes inside in table server control using c#thanks for the replay SABhatti u r right its loosing information on every post i did refered the example u told bt same is happening over here can u give me some example in coding form a very simple example one button and textbox when u click button textbox shud b added every time u click the button new textbox shud b added any help will be greatly appreciated thanks in advance
-
how to add row with checkboxes inside in table server control using c#I have a button called AddItem so i want whenever the button is got clicked new row shud be inserted on the table forexample when page is loaded there is no any row when user click the button one row shud be added when second time he clicks another row shud b inserted in the table control but the problem is at first time it inserts the row bt whn i click second time no row is inserted it shows only one row no matter how many times u click the button. I have addRow method in button click event which adds the row in the table when called. this situation is in c#. Actually i can make this in javascript but the problem is javascript cant create server side controls for example asp:textbox nd so on . i need to access the controls in each row through c# code so i cant achieve all the objectives in javascript. I hope u got understood wht the prob is.. I just want there shud be a function like addRow which adds the row in table when it is called in C# code any help will be greatly appreciated Aftab Ali Shaikh