为了账号安全,请及时绑定邮箱和手机立即绑定

GridView

GridView

一只斗牛犬 2018-10-10 05:06:52
怎么样获取GridView中选中行的值。不在前面添加任何按钮。。。。。怎么知道GridView中是选中的哪一行。。。。。
查看完整描述

2 回答

?
DIEA

TA贡献1820条经验 获得超2个赞

用gridview属性Rows.Count取值   比如

for (int i = 0; i < gvdata.Rows.Count; i++)   
            {                
                addxipurchbilling.Goods_id = Convert.ToInt32(gvdata.Rows[i].Cells[0].Text.ToString());
                addxipurchbilling.Goods_name = gvdata.Rows[i].Cells[1].Text.ToString();
                addxipurchbilling.Specifications = gvdata.Rows[i].Cells[2].Text.ToString();
                addxipurchbilling.Units_of_measurement = gvdata.Rows[i].Cells[3].Text.ToString();
                addxipurchbilling.PurchBilling_number = Convert.ToInt32(gvdata.Rows[i].Cells[4].Text.ToString());
                addxipurchbilling.PurchBilling_unitprice = Convert.ToDecimal(gvdata.Rows[i].Cells[5].Text.ToString());
                addxipurchbilling.PurchBilling_price = Convert.ToDecimal(gvdata.Rows[i].Cells[6].Text.ToString());
                addxipurchbilling.Goods_barcode = gvdata.Rows[i].Cells[7].Text.ToString();
            }


查看完整回答
反对 回复 2018-10-24
  • 2 回答
  • 0 关注
  • 452 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信