?
Solved

ASP.net Include a frame in a GridView

Posted on 2012-08-10
2
Medium Priority
?
763 Views
Last Modified: 2012-08-14
Hi

I got the following off Google maps to embed a street view into my ASP.net site

How would I update the code further down which puts images in a GridView to rather include this frame

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?
f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=47+Atholl-Oaklands+Road,+Johannesburg+2076,+South+Africa&amp;aq=&amp;sll=-26.135848,28.069382&amp;sspn=0.01098,0.024784&amp;ie=UTF8&amp;hq=&amp;hnear=47+Atholl-Oaklands+Rd,+Birnam,+Johannesburg,+City+of+Johannesburg+Metropolitan+Municipality,+Gauteng+2196,+South+Africa&amp;ll=-26.135848,28.069382&amp;spn=0.01098,0.024784&amp;t=m&amp;z=14&amp;layer=c&amp;cbll=-26.136924,28.067259&amp;panoid=r9ZiJXaettPfl6ub-zk41Q&amp;cbp=12,15.89,,0,0.81&amp;output=svembed"></iframe><br /><small><a href="https://maps.google.com/maps?f=q&source=embed&hl=en&geocode=&q=47+Atholl-Oaklands+Road,+Johannesburg+2076,+South+Africa&aq=&sll=-26.135848,28.069382&sspn=0.01098,0.024784&ie=UTF8&hq=&hnear=47+Atholl-Oaklands+Rd,+Birnam,+Johannesburg,+City+of+Johannesburg+Metropolitan+Municipality,+Gauteng+2196,+South+Africa&ll=-26.135848,28.069382&spn=0.01098,0.024784&t=m&z=14&layer=c&cbll=-26.136924,28.067259&panoid=r9ZiJXaettPfl6ub-zk41Q&cbp=12,15.89,,0,0.81" style="color:#0000FF;text-align:left">View Larger Map</a></small>



    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Page.DataBind()  
    End Sub

    Protected Sub btnSort_Click(sender As Object, e As EventArgs) Handles btnSort.Click
        Call SortGridView()
    End Sub

    Sub SortGridView()
        Try
            GridView1.DataSource = Nothing

            Dim dt As New DataTable()
            dt = GetData()
            Dim dv As DataView = dt.DefaultView
            dv.Sort = "Title"
            GridView1.DataSource = dv
            GridView1.DataBind()
        Catch ex As Exception

        End Try

    End Sub

    Function GetData() As DataTable
        ' This method creates a DataTable with four rows.  Each row has the
        ' following schema:
        '   PictureID      int
        '   PictureURL     string
        '   Title          string
        '   DateAdded      datetime
        Dim dt As New DataTable()
        ' define the table's schema
        dt.Columns.Add(New DataColumn("PictureID", GetType(Integer)))
        dt.Columns.Add(New DataColumn("PictureURL", GetType(String)))
        dt.Columns.Add(New DataColumn("Title", GetType(String)))
        dt.Columns.Add(New DataColumn("DateAdded", GetType(DateTime)))
        ' Create the four records
        Dim dr As DataRow = dt.NewRow()
        dr("PictureID") = 1
        dr("PictureURL") = ResolveUrl("~/Resources/Craighall_Hands_On_Retreat.jpg")
        dr("Title") = "zBlue Hills"
        dr("DateAdded") = New DateTime(2005, 1, 15)
        dt.Rows.Add(dr)
        dr = dt.NewRow()
        dr("PictureID") = 2
        dr("PictureURL") = ResolveUrl("~/Resources/Craighall_Park_Abbey_Guest_House.jpg")
        dr("Title") = "Sunset"
        dr("DateAdded") = New DateTime(2005, 1, 21)
        dt.Rows.Add(dr)
        dr = dt.NewRow()
        dr("PictureID") = 3
        dr("PictureURL") = _
          ResolveUrl("~/Resources/Melrose_Melrose_Place_Guest_Lodge.jpg")
        dr("Title") = "Water Lilies"
        dr("DateAdded") = New DateTime(2005, 2, 1)
        dt.Rows.Add(dr)
        dr = dt.NewRow()
        dr("PictureID") = 4
        dr("PictureURL") = ResolveUrl("~/Resources/Melrose_The_Peech_Hotel.jpg")
        dr("Title") = "Winter"
        dr("DateAdded") = New DateTime(2005, 2, 18)
        dt.Rows.Add(dr)
        Return dt
    End Function
0
Comment
Question by:Murray Brown
2 Comments
 
LVL 18

Accepted Solution

by:
Rajar Ahmed earned 2000 total points
ID: 38282970
replace pics url with your code

try this sample,
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="Button1" runat="server" Text="Button" />
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
        <Columns>
        <asp:BoundField DataField="Title" HeaderText="Title"/>
         <asp:TemplateField HeaderText="Flower" ItemStyle-Width="100px" >
       <ItemTemplate >
         <iframe id="frmGoogle" src='<%# Eval("PictureURL") %>'  runat="server"></iframe>    
       </ItemTemplate>
     
     </asp:TemplateField>
        </Columns>
        </asp:GridView>
    </div>
    </form>
</body>
</html>

Open in new window

    Function GetData() As DataTable
        ' This method creates a DataTable with four rows.  Each row has the
        ' following schema:
        '   PictureID      int
        '   PictureURL     string
        '   Title          string
        '   DateAdded      datetime
        Dim dt As New DataTable()
        ' define the table's schema
        dt.Columns.Add(New DataColumn("PictureID", GetType(Integer)))
        dt.Columns.Add(New DataColumn("PictureURL", GetType(String)))
        dt.Columns.Add(New DataColumn("Title", GetType(String)))
        dt.Columns.Add(New DataColumn("DateAdded", GetType(DateTime)))
        ' Create the four records
        Dim dr As DataRow = dt.NewRow()
        dr("PictureID") = 1
        dr("PictureURL") = "http://www.photographyblogger.net/wp-content/uploads/2010/05/flower23.jpg" 'ResolveUrl("~/Resources/Craighall_Hands_On_Retreat.jpg")
        dr("Title") = "zBlue Hills"
        dr("DateAdded") = New DateTime(2005, 1, 15)
        dt.Rows.Add(dr)
        dr = dt.NewRow()
        dr("PictureID") = 2
        dr("PictureURL") = "http://www.photographyblogger.net/wp-content/uploads/2010/05/flower24.jpg" 'ResolveUrl("~/Resources/Craighall_Park_Abbey_Guest_House.jpg")
        dr("Title") = "Sunset"
        dr("DateAdded") = New DateTime(2005, 1, 21)
        dt.Rows.Add(dr)
        dr = dt.NewRow()
        dr("PictureID") = 3
        dr("PictureURL") = "http://www.photographyblogger.net/wp-content/uploads/2010/05/flower25.jpg" '        ResolveUrl("~/Resources/Melrose_Melrose_Place_Guest_Lodge.jpg")
        dr("Title") = "Water Lilies"
        dr("DateAdded") = New DateTime(2005, 2, 1)
        dt.Rows.Add(dr)
        dr = dt.NewRow()
        dr("PictureID") = 4
        dr("PictureURL") = "http://www.photographyblogger.net/wp-content/uploads/2010/05/flower26.jpg" ' ResolveUrl("~/Resources/Melrose_The_Peech_Hotel.jpg")
        dr("Title") = "Winter"
        dr("DateAdded") = New DateTime(2005, 2, 18)
        dt.Rows.Add(dr)
        Return dt
    End Function

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            GridView1.DataSource = Nothing
            Dim dt As New DataTable()
            dt = GetData()
            Dim dv As DataView = dt.DefaultView
            dv.Sort = "Title"
            GridView1.DataSource = dv
            GridView1.DataBind()
        Catch ex As Exception
        End Try
    End Sub

Open in new window

0
 

Author Closing Comment

by:Murray Brown
ID: 38292918
Thanks for the help
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question