Reputation: 1
So here is the code and i have the following problem, i don't know how to create a hyperlink object for the column.
DataTable dt = new DataTable();
DataRow dr = null;
dt.Columns.Add(new DataColumn("Име на настанот", typeof(string)));
dt.Columns.Add(new DataColumn("Информации за настанот", typeof(string)));
dt.Columns.Add(new DataColumn("Локација", typeof(string)));
dt.Columns.Add(new DataColumn("Време и датум на настанот", typeof(string)));
dt.Columns.Add(new DataColumn("Измени", typeof(HyperLink)));
dt.Columns.Add(new DataColumn("Бриши", typeof(string)));
foreach (Google.GData.Calendar.EventEntry entry in calFeed.Entries)
{
HyperLink a = new HyperLink();
a.NavigateUrl = "aaa";
dr = dt.NewRow();
dr["Име на настанот"] = entry.Title.Text.ToString();
dr["Информации за настанот"] = entry.Content.Content.ToString();
dr["Локација"] = entry.Locations[0].ValueString.ToString();
dr["Време и датум на настанот"] = "Почеток: " + entry.Times[0].StartTime.ToString() + " Крај: " + entry.Times[0].EndTime.ToString();
dr["Измени"] = a.NavigateUrl; //what to add here how to add a hyperlink
dt.Rows.Add(dr);
ViewState["CurrentTable"] = dt;
GridView1.DataSource = dt;
GridView1.DataBind();
}
The error i get is:
The XML element 'EnableTheming' from namespace '' is already present in the current scope. Use XML attributes to specify another XML name or namespace for the element.
Upvotes: 0
Views: 864
Reputation: 12748
You might have to use the RowDataBound event. Or use the <asp:TemplateField> in your grid, this way you can add custom html into a column.
Upvotes: 0
Reputation: 39767
Make that column a normal string:
dt.Columns.Add(new DataColumn("Измени", typeof(String)));
Then you can simple assign an HTML code for the link:
dr["Измени"] = "<a href='aaa'>Click Here</a>";
Upvotes: 2