无法获得文本框值 [英] Not geting textbox value

查看:78
本文介绍了无法获得文本框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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 ";

               }
           }

推荐答案

我相信文本框是动态创建的. 单击链接"时,将触发页面加载,并且文本框已初始化,并且值丢失.
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.


这篇关于无法获得文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆