I am using this code to give unique id to each row of GridView
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
GridViewRow row = e.Row;
if (row.RowType == DataControlRowType.DataRow)
{
row.Attributes["id"] = cRowID.ToString();
cRowID++;
}
}
where cRowID is global integer variable.
This code gives me HTML code as
<table id="gridview1">
<tr id="1"><td>...</td></tr>
<tr id="2"><td>...</td></tr>
.
.
<tr id="n"><td>...</td></tr>
</table>
How can I replace the cRowID with the specific column(say column1) value which is getting added to that same row?
EDIT
after adding the ID of tr tag in HTML I want it to become
<tr id="abc" ><td>abc</td><td>...</td></tr>
<tr id="pqr" ><td>pqr</td><td>...</td></tr>
<tr id="xyz" ><td>xyz</td><td>...</td></tr>
Is it possible? If yes, please explain how?
Tested Try this
Edited