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.
Articles
- Articles(C#.NET) (3)
- ASP.NET (6)
- Asp.Net(Email) (1)
- Asp.net(Image) (2)
- Asp.Net(Web.Config) (2)
- C#.NET (5)
- C#.NET Threading (3)
- C#.NET(ASP.NET) (4)
- Comments in PHP (1)
- Encryption In PHP (1)
- iPhone (Articles) (1)
- JavaScript (1)
- Json with PHP (1)
- LINQ (1)
- PHP (2)
- PHP Constant (1)
- PHP Operators (1)
- PHP Print Command (1)
- PHP Tutorial (2)
- Strings In PHP (1)
- Variable Declaration In PHP (1)
- WPF (1)
- XAML (2)
About Me
Help Link
Followers
Posted by
Sreejith A.K
Wednesday, September 30, 2009
Labels:
ASP.NET
Subscribe to:
Post Comments (Atom)