Solved

ASP.NET dynamic iFrame URL from TextBox

Posted on 2010-08-27
4
739 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 35

Expert Comment

by:YZlat
ID: 33545658
what error are you getting now?
0
 

Author Comment

by:Barneye
ID: 33545903
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
ID: 33555753
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
ID: 33599791
Anybody?
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

705 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