1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How we can send Current page to different aspx page

Discussion in 'C#' started by webmaster8757, Dec 10, 2009.

  1. #1
    I m confused that how can i post current page to different Aspx page.please help me.Please explain me by giving some suitable examples.
     
    webmaster8757, Dec 10, 2009 IP
  2. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #2
    One way is to pass it through a querystring using response.redirect. e.g:
    (just typing this into the browser, but you should get the drift.
    
    Private Sub Submit1_Onclick(Byval sender..... etc)
          Response.Redirect("formhandler.aspx?id=" & Textbox1.Text & "&page=" & TextBox2.Text "&var1=" & Textbox3.Text)
    End Sub
    
    Code (markup):
    There is probably a better way, but that is all I have ever had to do...
     
    camjohnson95, Dec 14, 2009 IP
  3. pom4ik

    pom4ik Greenhorn

    Messages:
    31
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    16
    #3
    Hi,

    You can also send your button to a sub which will store the data from your form into a viewstate or session variables and you can retrive them from other pages. as long as your session is still active.
     
    pom4ik, Dec 15, 2009 IP
  4. SIPHILP

    SIPHILP Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    What version of ASP.NET are you using? Am sure you'll be using 2.0 +?

    Since 2.0 they introduced the cross-page postback feature see msdn for details:

    msdn.microsoft.com/en-us/library/ms178139.aspx
     
    SIPHILP, Dec 17, 2009 IP
  5. sbglobal79

    sbglobal79 Banned

    Messages:
    724
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    55
    #5
    u can use response.redirect method . U can also use server.transfer command .
     
    sbglobal79, Dec 17, 2009 IP
  6. shall

    shall Member

    Messages:
    111
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    28
    #6
    Response.Redirect("page.aspx");

    you can put this in the codebehind of a button, or something.
    regards
     
    shall, Dec 19, 2009 IP
  7. makeitlive

    makeitlive Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    what do you mean by saying "post current page". Do you want to post all the form element values or just perform a simple redirection ?

    If redirection then use
    Response.Redirect("yourpage.aspx")

    Otherwise
    you can use crosspage postbacks or you can store values in session (no really recommended). Also you can create properties on the first page (public properties) and then add refference to this page into second page.

    I would not recommend sending form params in url (GET) unless you know and you make sure that length or the url will not exceed the max length for different browsers. Also you need to encode url if you choose this method.

    hope that helps.
     
    makeitlive, Dec 21, 2009 IP
  8. avkluki

    avkluki Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I guess you use something like submit button on the form - at this case specify target page in the <asp:Button PostBackUrl=".."> property.
     
    avkluki, Dec 24, 2009 IP
  9. avkluki

    avkluki Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    In a case of a simple form (not asp) you can specify <form action=".."> attribute with the same effect - data will be posted to the url specified in the "action"
     
    avkluki, Dec 24, 2009 IP
  10. awhgemma

    awhgemma Peon

    Messages:
    18
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #10
    If you want to change the default start page of an application you can right click on the desired page in the explorer pane in visual studio and set it as the starting page of the application. Alternatively, you can set it via IIS.

    As other people have suggested you can also use the following code in the Page_Load event;

    Response.Redirect("NAMEOFPAGE.aspx);

    However;
    I would not suggest doing so if it is a public application and PageRank is important as Google frown upon redirects on homepages so doing so will screw with your SEO


    Hope this helped mate.
     
    awhgemma, Jan 26, 2010 IP
  11. jonmaster

    jonmaster Peon

    Messages:
    181
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Are you asking about redirect, or just plain html link , or the hyperlink control in asp.net
     
    jonmaster, Jan 26, 2010 IP
  12. chanda

    chanda Peon

    Messages:
    155
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    with the help of
    response.redirect("pagename.aspx?ab="+textbox1.text+");

    pagename.aspx is name of page where u want to send the data.
     
    chanda, Aug 5, 2010 IP