jott
06-12-2006, 09:45 AM
I'm attempting to use a dataview that is using the first column as a Hyperlink column that will redirect according to the type of record. The question that I have: "Is there a way to modify the Dataview:NavigateUrl depending on data to be displayed during runtime?"
If IsDefect=0 then
Datagrid1.NavigateUrl="../Tickets/tickets.aspx?TicketID={0}"
elseif IsDefect=1 then
Datagrid1.NavigateUrl="../Defects/defects.aspx?TicketID={0}"
else
Datagrid1.NavigateUrl="../Startup/Startup.aspx"
endif
The above code is the logic for each of the NavigateURL fields but I haven't figured out how to include this logic while populating the Datatable
Datagrid layout
Column0 Hyperlink Column ("TicketID")
Column1 BoundField ("Ticket_Desc")
Column2 BoundField ("AssignID")
Dim Tickets as New Dataset()
adapter.Fill (Tickets)
..
Dim DTable as New DataTable
Dim Row as DataRow
For Each row in Tickets.Tables(0).Rows
row = DTable.NewRow()
row(0) = row("TicketID").ToString()
row(1) = row("Ticket_Desc").ToString()
row(2) = row("AssignTo").ToString()
DTable.Rows.Add(row)
Next
Gridview1.DataSource = DTable
Gridview1.DataBound()
Have help would be greatly appreciated. Thanks in advance.
Jacky :confused:
If IsDefect=0 then
Datagrid1.NavigateUrl="../Tickets/tickets.aspx?TicketID={0}"
elseif IsDefect=1 then
Datagrid1.NavigateUrl="../Defects/defects.aspx?TicketID={0}"
else
Datagrid1.NavigateUrl="../Startup/Startup.aspx"
endif
The above code is the logic for each of the NavigateURL fields but I haven't figured out how to include this logic while populating the Datatable
Datagrid layout
Column0 Hyperlink Column ("TicketID")
Column1 BoundField ("Ticket_Desc")
Column2 BoundField ("AssignID")
Dim Tickets as New Dataset()
adapter.Fill (Tickets)
..
Dim DTable as New DataTable
Dim Row as DataRow
For Each row in Tickets.Tables(0).Rows
row = DTable.NewRow()
row(0) = row("TicketID").ToString()
row(1) = row("Ticket_Desc").ToString()
row(2) = row("AssignTo").ToString()
DTable.Rows.Add(row)
Next
Gridview1.DataSource = DTable
Gridview1.DataBound()
Have help would be greatly appreciated. Thanks in advance.
Jacky :confused: