Software Programs and Projects

This Software Programs and Projects include programing tips and technology using different languages like VC++,ASP,JSP C#.Net,PHP,VB.Net,JavaScript,ASP.NET .Software Programs and Projects blog mainly support to software programmers and provide help through the mail.

Get a Cell value in Gridview using C#.net .Implement these code into the Gridview's DataBound Event .Find Header Row in the Gridview and to replace some value into the Cell corresponding Header Row.

#region Set Female and Male Value into the Personal Gridview

protected void grdPersonalDetails_DataBound(object sender, EventArgs e)
{
GridViewRow headerRow = grdPersonalDetails.HeaderRow;
for (int iIndex = 0; iIndex < headerRow.Cells.Count; iIndex++)
{
//Get Header Name
string strHeaderName = headerRow.Cells[iIndex].Text.ToString();
if (strHeaderName == "Gender")
{
for (int iValue = 0; iValue < grdPersonalDetails.Rows.Count; iValue++)
{
//Get Cell value
string strGender = grdPersonalDetails.Rows[iValue].Cells[iIndex].Text; //Check Male
if (strGender == "1")
{
grdPersonalDetails.Rows[iValue].Cells[iIndex].Text = "Male";
}
//check Female
if (strGender == "2")
{
grdPersonalDetails.Rows[iValue].Cells[iIndex].Text = "Female";
}
}

break;
}

}
#endregion

tag:-Get a Cell value in Gridview using C#.net .Implement these code into the Gridview's DataBound Event .Find Header Row in the Gridview and to replace some value into the Cell corresponding Header Row.

2 comments:

Get Cell Contents in GridView using C#.Net

Good

Post a Comment

Post a Comment