如何访问datagrid中itemcommand中的文本框. [英] how to access textbox in itemcommand in datagrid .

查看:93
本文介绍了如何访问datagrid中itemcommand中的文本框.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

protected void dgvJobSearch_ItemCommand(object source, DataGridCommandEventArgs e)
    {
        if (e.CommandName == "BID")
        {

           string strBid = serviceus.getMaxId("SERVICEUS_BID", "BID_ID");
            int Bid= Convert.ToInt32(strBid);
            string strJobTile = (string)((Label)e.Item.Cells[0].Controls[3]).Text;//Desc
            string strTransactionid = (string)((Label)e.Item.Cells[0].Controls[7]).Text;//Time
            string strMember = (string)((Label)e.Item.Cells[0].Controls[11]).Text;//Time
            string strDescrption = (string)((Label)e.Item.Cells[0].Controls[13]).Text;//Time
            string strAmount = (string)((TextBox)e.Item.Cells[0].Controls[17]).Text;//Time
            string strCooment = (string)((TextBox)e.Item.Cells[0].Controls[21]).Text;//Time
            DateTime strProjectEndDate = (DateTime)(Convert.ToDateTime(((Label)e.Item.Cells[0].Controls[29]).Text));//Time
            string strProviderId = (string)((Label)e.Item.Cells[0].Controls[31]).Text;//Time
             string strProjectId = (string)((Label)e.Item.Cells[0].Controls[33]).Text;//Time
            //int strUserId = Convert.ToInt32(Session["Userid"].ToString());
            TimeSpan strPEndDate = strProjectEndDate - DateTime.Now;
            string strPEDATE = strPEndDate.Days.ToString();

            string strBidCount = serviceus.Get_SERVICEUS_BIDS_COUNT(strProjectId);

            int strUserId = 1;

            strBidCount = strBidCount + 1;

            serviceus.UPDATE_SERVICEUS_BIDS_COUNT(strProjectId, strBidCount);

            //strPEndDate.Days;
            serviceus.Insert_ServiceUs_BID(Bid, strAmount, "", strPEDATE, DateTime.Now.ToShortDateString(), strProviderId, strProjectId, strBidCount, strTransactionid, strUserId, "PENDING");

        }
    }

推荐答案

您尝试在单元格级别使用FindControl而不是对控件建立索引吗?
Did you try using FindControl at cell level instead of indexing the control?


这篇关于如何访问datagrid中itemcommand中的文本框.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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