Solved

ASP.NET dynamic iFrame URL from TextBox

Posted on 2010-08-27
4
723 Views
Last Modified: 2012-05-10
I know I'm close to an answer. I need to dynamically set the URL of and iFrame from the input in a TextBox. I loose it after the FilterExpression for the Pricing.Click handler. I don't know how to finish it.

Here is what I have so far.....


ASP Page:
<form id="form1" runat="server">
 <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
     ConnectionString="<%$ ConnectionStrings:CTweb %>" 
     ProviderName="<%$ ConnectionStrings:CTweb.ProviderName %>" 
     SelectCommand="SELECT [CTSERIES], [IntranetPricing], [Webspec] FROM [SpecLinks]"></asp:SqlDataSource>

    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        <asp:TextBox ID="CTSeriesTextBox" runat="server" AutoComplete="Off"></asp:TextBox>
        <cc1:AutoCompleteExtender ID="CTSeries_AutoCompleteExtender" runat="server" 
             Enabled="True"  TargetControlID="CTSeriesTextBox" ServiceMethod="GetSpec" EnableCaching="False" >
        </cc1:AutoCompleteExtender>
    </div>
    <div class="buttons">
    <asp:Button ID="Spec" runat="server" Text="Spec" onclick="submitspec_Click"/>
    <asp:Button ID="Pricing" runat="server" Text="Pricing" onclick="submitpricing_Click"/>
    </div>
    </form>

Open in new window

CodeBehind In VB

 
Imports System.Linq

Partial Class CT_Info
    Inherits System.Web.UI.Page


    <System.Web.Services.WebMethod()> _
    Public Shared Function GetSpec(ByVal prefixText As String, ByVal count As Integer) As String()
        Dim db As New DataClassesDataContext()
        Return db.CT_Series.Where(Function(n) n.CTSERIES.StartsWith(prefixText)).OrderBy(Function(n) n.CTSERIES).Select(Function(n) n.CTSERIES).Take(count).ToArray()

    End Function



    Protected Sub submitspec_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Spec.Click
        CTSeriesTextBox.Text = CTSeriesTextBox.Text.ToLower()
        literal1.Text = ("<iframe id='Iframe1' name='embeddedFrame' width='725' height='850' src='http://snap2265216/Library//central_tech/CT%20Current%20Specs/" + CTSeriesTextBox.Text + ".pdf#zoom=64' />")
    End Sub

    Protected Sub submitpricing_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Pricing.Click

        SqlDataSource1.FilterExpression = "ctseries = #" + CTSeriesTextBox.Text + "#"

        literal1.Text = ("<iframe id='Iframe1' name='embeddedFrame' width='900' height='900' src='http://192.168.100.5/excel_files/" + IntranetPricing + "' />")
    End Sub

End Class

Open in new window




0
Comment
Question by:Barneye
  • 3
4 Comments
 
LVL 35

Expert Comment

by:YZlat
Comment Utility
what error are you getting now?
0
 

Author Comment

by:Barneye
Comment Utility
No error when I load the page, or click the button, but the URL for the iFrame is not complete. The page name is missing from the end of the URL.


<iframe width="900" height="900" src="http://192.168.100.5/excel_files/" name="embeddedFrame" id="Iframe1">

The "IntranetPricing" variable in the URL is not getting populated.

Visual Web Developer 2010 , does give a error "'IntranetPricing' is not declared"
   
0
 

Author Comment

by:Barneye
Comment Utility
Here's the exact section I'm having an issue with. I need to take the input from the text box, filter the data and pass the intranetpricing column to the URL.


Protected Sub submitpricing_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Pricing.Click

        SqlDataSource1.FilterExpression = "ctseries = #" + CTSeriesTextBox.Text + "#"

        literal1.Text = ("<iframe id='Iframe1' name='embeddedFrame' width='900' height='900' src='http://192.168.100.5/excel_files/" + IntranetPricing + "' />")
    End Sub

Open in new window

0
 

Accepted Solution

by:
Barneye earned 0 total points
Comment Utility
Anybody?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now