如何在c#中获取gridview下拉项模板值

编程入门 行业动态 更新时间:2024-10-24 22:27:14
本文介绍了如何在c#中获取gridview下拉项模板值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何获取Gridview Cell值下拉列表明智更新,在SourceCode(.CS)下面没有得到gvrow.Cells [3] .Text 源代码(.cs)

How to get Gridview Cell value Dropdown list wise Update,below SourceCode(.CS) not get gvrow.Cells[3].Text Source code(.cs)

protected void ddlInformType_OnSelectedIndexChanged(object sender, EventArgs e) { double leave = 0; GridViewRow gvrow = ((DropDownList)sender).Parent.Parent as GridViewRow; DropDownList ddlInformType = (DropDownList)gvrow.FindControl("ddlInformType"); if (ddlInformType.SelectedValue == "Prior") { leave = Convert.ToDouble(gvrow.Cells[3].Text) - 1; return; } if (ddlInformType.SelectedValue == "Late informed") { leave = Convert.ToDouble(ViewState["Leave"].ToString()) - 0.5; return; } if (ddlInformType.SelectedValue == "Not Informed") { leave = Convert.ToDouble(gvrow.Cells[4].Text) + 1; return; } }

此来源未获取gvrow.Cells [3] .Text值所以如何获取gridview单元格值 i想要在gridview中更新gvrow.Cells [3] .Text 谢谢

This Source Not get gvrow.Cells[3].Text values So how to get gridview cell value i want Update gvrow.Cells[3].Text in gridview Thanks

推荐答案

foreach(GridViewRow row in allRmaGv.Rows) { // Try to find the `dcDdl` in data rows only, because they do not exist in header or footer rows if (row.RowType == DataControlRowType.DataRow) { DropDownList dcDropDown = (DropDownList)row.FindControl("dcDdl"); dcDropDown.SelectedValue = value; } }

更多推荐

如何在c#中获取gridview下拉项模板值

本文发布于:2023-11-16 16:20:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1605889.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模板   如何在   gridview

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!