Solved

ASP.NET dynamic iFrame URL from TextBox

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASP.Net Session State alternatives 3 60
ISS migration from IIS 6 to IIS 8.5 rendering problems 4 51
error on the asp.net page 1 33
Entity Framework 7 32
I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
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 the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 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

18 Experts available now in Live!

Get 1:1 Help Now