1: protected void gvNew_RowDataBound(object sender, GridViewRowEventArgs e)
2: {
3: int random = 1;
4: int count = e.Row.Cells.Count;
5:
6: if (e.Row.RowType == DataControlRowType.DataRow)
7: {
8: string str = e.Row.Cells[0].Text;
9: }
10: else if (e.Row.RowType == DataControlRowType.Footer)
11: {
12:
13: Label lblEdit = new Label();
14: lblEdit.Text = " ";
15: Table tbl = new Table();
16: tbl = (Table)e.Row.Parent;
17: GridViewRow myRow = new GridViewRow(0, 0, DataControlRowType.DataRow, DataControlRowState.Normal);
18: DataTable dt = new DataTable();
19: dt = (DataTable)this.dtOCCRateList;
20:
21: for (int i = 0; i < count; i++)
22: {
23: TableCell myCell = new TableCell();
24: // need to create the edit hyperlink in the the footer
25:
26: if (i == 0)
27: {
28: // leave blank
29: myCell.Controls.Add(new LiteralControl(""));
30: }
31: else
32: {
33: // create the image and hyperlink
34: HyperLink editLink = new HyperLink();
35: editLink.ID = "editLink" + random;
36:
37: // set the image url
38: editLink.ImageUrl = "~/library/images/ico-edit.gif";
39:
40: // set the navigate url
41: editLink.NavigateUrl = "~/Default.aspx?Id=" + dt.Rows[0][i].ToString()
42: + "&PId=" + AssetId.ToString();
43:
44: // now add this hyperlink in the table cell
45: myCell.Controls.Add(editLink);
46:
47: // add delete
48: HyperLink delLink = new HyperLink();
49: delLink.ID = "delLink" + random;
50: random++;
51:
52:
53: delLink.ImageUrl = "~/Library/images/delete.gif";
54:
55: // set the navigate url
56: delLink.NavigateUrl = "~/Default.aspx?Id=" + dt.Rows[0][i].ToString()
57: + "&PId=" + AssetId.ToString();
58:
59: myCell.Controls.Add(new LiteralControl(" "));
60: myCell.Controls.Add(delLink);
61: }
62:
63: myRow.Cells.Add(myCell);
64: tbl.Rows.Add(myRow);
65: }
66: }
67:
68: }