Solved

ASP.NET dynamic iFrame URL from TextBox

Posted on 2010-08-27
4
738 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

737 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