Solved

ASP.NET dynamic iFrame URL from TextBox

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

821 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