I'm displaying a gridview with several entries of data, one of the data fields is date, I want the user to be able to click any date on the gridview, and use it to start a process on the same page, which would include hiding the gridview and displaying general info regarding that specific date, no insert, update or anything database related, only a call to a process. The same thing being done manually right now by selecting from a calendar and clicking a regular button.
How can I make this field only a linkbutton?
I already tried adding the field manually on ASP this way:
<asp:GridView ID="myGrid" runat="server" CssClass="Gridview">
<Columns>
<asp:HyperLinkField Text="test" />
</Columns>
</asp:GridView>
But it only creates a new field which is something I don't need. Also it must be done on code-behind since that's where I'm creating the datatable which later gets sent to the gridview, like this:
Dim myTable As DataTable = New DataTable
Dim column As DataColumn
Dim row As DataRow
column = New DataColumn()
column.ColumnName = "ID"
myTable.Columns.Add(column)
column = New DataColumn()
column.ColumnName = "Date"
myTable.Columns.Add(column)
For myRow As Integer = 0 To days
row = myTable.NewRow()
row("ID") = "Some ID"
row("Date") = datevalue.AddDays(myRow).ToString("dd/MM/yyyy")
myTable.Rows.Add(row)
Next
myGrid.DataSource = myTable
myGrid.DataBind()
Everything works fine, but I somehow need to make that date field a linkbutton, any ideas?