I want to take LangId
value in RowDataBound function. How to do this?
<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;
}
}
There are a couple of ways to do it. Maybe more.
<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
}
}