Hello all,
In VC# 2005, I want to store a link to a page say Edit.aspx on a DataRow object and i used
the following code:
protected void Page_Load(object sender, EventArgs e)
{
DataTable dtbl = new DataTable();
DataColumn dcol = new DataColumn("LINK");
dtbl.Columns.Add(dcol);
DataRow dRow;
dRow = dtbl.NewRow();
dRow[0]= "<a href = '../EventsCalendar/Edit.aspx '>" + "Edit" + "</a>";
dtbl.Rows.Add(dRow);
grdvw.DataSource = dtbl;
grdvw.DataBind();
}
There is a GridView Control also called grdvw where Iam binding my DataTable object Called
dtbl to this GridView Control.The code is,
grdvw.DataSource = dtbl;
grdvw.DataBind();
Now the problem with this code is the variable dRow[0] is storing the whole string in place
of storing only Edit as hyperlink.
I mean to say dRow[0] == "<a href = '../EventsCalendar/Edit.aspx '>" + Edit + "</a>";
Due to this problem Iam not getting the Edit link on my Gridview 0th Column cell. Instead of
Edit link Iam getting the whole string which is <a href = '../EventsCalendar/Edit.aspx
'>Edit</a>.
It seems that html tags <a>, and single and double quotes are not recognised by this program.
But when I used DataGrid Control I got the proper output. Why this problem is happening with the GridView control only? Can anyone tell me.
CAN ANYONE HELP ME OUT to get the desired result on my Gridview control?
Waiting for your early response.
Please Do reply very soon. Iam in need of urgent help!!!!
