Search code examples
asp.netvb.netdata-visualizationgoogle-visualizationvisual-web-developer

Hot Ti Insert Script In An ASP.NET Form On Run Time


I am saving Visualizations in a database, title, description...etc and CODE field, in the Code field I save the "code" that will generate the visualization, it may be as simple as a URL for an image hosted somewhere, or something like:

<script src="https://spreadsheets.google.com/gpub?url=http%3A%2F%2Foj0ijfii34kccq3ioto7mdspc7r2s7o9-ss-opensocial.googleusercontent.com%2Fgadgets%2Fifr%3Fup_title%3DBrands%26up_initialstate%26up__table_query_url%3Dhttps%253A%252F%252Fspreadsheets.google.com%252Fspreadsheet%252Ftq%253Frange%253DA%25253AE%2526key%253D0AqFjLMbUaBn_dFhwbV9DQ3N6cWN1SmFiUlF5X1RXUkE%2526gid%253D0%2526pub%253D1%26url%3Dhttp%253A%252F%252Fwww.google.com%252Fig%252Fmodules%252Fmotionchart.xml%26spreadsheets%3Dspreadsheets&height=448&width=710"></script>

I am saving this as an nvarchar(max) in my database, now I have a page that should display the visualization I call on run time, so what is the best way to do so?! a div for example? and how?

Thanks in dvance


Solution

  • ok, here you go Maen ...

    1) Declare your IFrame (you can set more properties like height & width):

    <IFRAME id="frame1" scrolling="auto" runat="server">
    </IFRAME>
    

    2) Get the URL from your "Script" stored in your Database

    frame1.Attributes["src"] = DAL.GetURLPath();
    

    does this help?