Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
protected void lnk_Click(object sender, EventArgs e)
       {


           for (int i = 0; i < 10; i++) // Loop for Row
           {
               string txtvalue1 = "TextBoxCol_" + i.ToString();

               TextBox txt1 = (TextBox)Page.FindControl(txtvalue1);


                if (txt1 != null)
           {
               try
               {

                   string strText1 = txt1.Text;
                  // int ItemId = TaxItemMasterPayrollDB.AddItem(str);

               }
               catch (Exception ex)
               {
                   throw ex;
                   //lbl_error.Text = "There is a Problem while creating Account ";

               }
           }
Posted
Comments
Vani Kulkarni 11-Jul-12 4:41am    
Try to debug the code, see what is txt1.Text is returning.
Sandeep Mewara 11-Jul-12 5:03am    
This is not a well framed question! Please elaborate on what is happening and what you get. DEBUG and share the workflow.
Use the "Improve question" link to edit your question and provide better information.
pradiprenushe 11-Jul-12 6:11am    
Have you added textbox dynamically?

1 solution

I believe the Text Boxes are created dynamically.
When Link is clicked the page load will be firing and the textbox is getting initialized and the value is lost.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900