bar*_*ros 2 c# asp.net gridview boundfield
LangId
我想在 RowDataBound 函数中获取值。这个怎么做?
<asp:BoundField DataField="LangId" HeaderText="LangId" Visible="false" />
protected void grdList_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
// need LangId
ImageButton imgBtn = (ImageButton)e.Row.FindControl("imgBtnDelete");
imgBtn.Visible = false;
}
}
Run Code Online (Sandbox Code Playgroud)
有几种方法可以做到这一点。也许更多。
<asp:BoundField DataField="LangId" HeaderText="LangId" Visible="false" />
protected void grdList_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string langId = e.Row.Cells[columnIndex].Text; // one of the ways
string langId2 = DataBinder.Eval(e.Row.DataItem, "LangId").ToString(); // one of the other ways
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
17554 次 |
最近记录: |