Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

ASP.NET question

  • 01-12-2003 11:57PM
    #1
    Registered Users, Registered Users 2 Posts: 2,621 ✭✭✭


    <%@ Page Explicit = "True" Language = "VB" Debug= "True"%>
    <%@ Import Namespace = "System.Data"%>
    <%@ Import Namespace = "System.Data.OleDb"%>
    <SCRIPT RUNAT="Server">
    Sub OKButton_Click(Sender As Object, E As EventArgs)
    Dim myPants As string

    myPants = Search.text

    End Sub
    </SCRIPT>


    <HTML>
    <BODY>
    <FORM RUNAT="Server">
    <P>Search</P>

    <ASP:TEXTBOX ID="Search" RUNAT="Server" MAXLENGTH="5" COLUMNS = "20"/>

    <ASP:BUTTON TEXT="OK" ONCLICK="OKButton_Click" RUNAT="Server"

    </FORM>
    </BODY>
    </HTML>

    Right my question is, the above code is incomplete.... I want to move the contents for search.text to www.blah.com/blah.aspx?first=myPants

    Any idea how I can achieve this?


Comments

  • Closed Accounts Posts: 8 WoodyWoodPecker


    try using,

    Response.Redirect("http://www.blah.com/blah.aspx?first=&quot; + myPants);

    but if the blah.com is not an external web page best to use something like

    Response.Redirect("blah.aspx?first=" + myPants);


  • Registered Users, Registered Users 2 Posts: 2,621 ✭✭✭GreenHell


    Sound, I've a another newbie question for ya

    SelectStatement = "Select nameoftxt from story where story_id = "%fileNam%""
    fileNam is an integer and its not working right I've tried using it this way

    SelectStatement = "Select nameoftxt from story where story_id = '%" & fileNam & "%'" but thats not working right either. Any ideas ?


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    Off the top of my head so don't hold me to it:

    "Select nameoftxt from story where story_id = "%fileNam.toString()%""


  • Closed Accounts Posts: 8 WoodyWoodPecker


    heres my thoughts,

    your current query has the % symbol which indicates to the query to perform wildcard searches, you typically need to use the like operator for this to work...


    SelectStatement = "Select nameoftxt from story where story_id like '%" + fileNam.ToString() + "%'"


    this should work and give you results, but perhaps too many as filNam with a value of 1 returns 1, 11, 21, 31, etc....

    try for a single result (no wildcard search)

    SelectStatement = "Select nameoftxt from story where story_id = " + fileNam.ToString();

    you may also need to work on the synax of the query depending on database your working with....


  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    Adding further to the mix...

    it depends where your code is running. If its client-side, then I would expect it should be something like :

    SelectStatement =
    "Select nameoftxt from story where story_id = " & %filename%

    (might need + instead of & in that depending on what scripting language you use).

    If its serverside, then %filename% doesn't work. Isn't it something like :

    SelectStatement =
    "Select nameoftxt from story where story_id = " & Response("filename")


    jc


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,621 ✭✭✭GreenHell


    Might as well stay in the same thread.

    <ASP:HyperLinkColumn
    HeaderText = "Title"
    DataNavigateURLField="story_id"

    DataNavigateURLFormatString =="javascript:varwin=window.open(''preview.aspx?story_id={0}'',null,'width=692,height=25');"
    DataTextField="Title"

    />

    Parser Error Message: Literal content ('<ASP:HyperLinkColumn HeaderText = "Title" DataNavigateURLField="story_id" DataNavigateURLFormatString =="javascript:varwin=window.open(''preview.aspx?story_id={0}'',null,'width=692,height=25');" DataTextField="Title" />') is not allowed within a 'System.Web.UI.WebControls.DataGridColumnCollection'.

    Any idea? Should I be include a specific namespace or what? Cheers for the help on the last one.


  • Closed Accounts Posts: 8 WoodyWoodPecker


    i think the issue lies with the "==" in the assignment of DataNavigateURLFormatString, just remove the second equal operator something like this....


    <ASP:HyperLinkColumn
    HeaderText = "Title"
    DataNavigateURLField="story_id"

    DataNavigateURLFormatString ="javascript:varwin=window.open(''preview.aspx?story_id={0}'',null,'width=692,height=25');"
    DataTextField="Title"

    />



    this will probably work, your window will popup and you see your data come across but in the background a new window may open and the text "[object]" may appear if so use this snippet of code (method of opening the popup changes),

    <asp:HyperLinkColumn HeaderText="Title" DataNavigateUrlField="story_id" DataNavigateUrlFormatString="javascript:void(window.open('preview.aspx?story_id={0}',null,'width=692,height=225'));" DataTextField="Title" ></asp:HyperLinkColumn>


  • Registered Users, Registered Users 2 Posts: 2,621 ✭✭✭GreenHell


    Perfect thanks.


Advertisement