I am working a fairly basic web based KPI system and am struggling to get my head round this problem.
I have a top level page which has Gridview containing various items we are tracking and their current status. There is also a Hyperlink field that provides links to external pages / data. I need to open these links within a frame in the current site to maintain the look and feel of it.
If I hard code the src value for the iFrame it works fine but what I need to do is pass the URL contained in the LeafURL field into the KPIFrame.Attributes(“SRC”) = “Need something here”
so the question is how do I call the URL details from the previous page and inject it into the iFrame src field on the new page.
This is the code on my main page. Somehow I need the next page to pick up the linktext(LeafURL) value from the Gridview on this page.
Protected Sub GridView1_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowCreated
If e.Row.RowType = DataControlRowType.DataRow Then
Dim linknew As HyperLink
Dim linktext as String
linktext = e.Row.DataItem("LeafURL")
linknew = e.Row.FindControl("Hyperlink1")
If e.Row.DataItem("Status") = "0" Or "1" Then
linknew.NavigateUrl = ("~/leaf.aspx")
End If
End If
End Sub
Any guidance would be greatly appreciated.
All sorted now. The solution lay in correctly constructing the querystring on the 1st page so that is could be referenced on the 2nd page. As shown below:
Code on 1st Page:
Code on 2nd Page:
Turned out to be much simpler than it first appeared to solve this problem.
Now have system working where the URL value in the GridView on page 1 is passed to page 2 and used to determine the src value for the iframe on that page.