User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 402,754 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,483 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 27901 | Replies: 4
Reply
Join Date: May 2005
Posts: 15
Reputation: ramareddy_dotne is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
ramareddy_dotne ramareddy_dotne is offline Offline
Newbie Poster

request.form is not working in asp.net

  #1  
May 1st, 2005
I want to retrieve data from controls in the requested page to other page by
using request.form(control name) but this is not working for me.I tried both response.redirect and also server.transfer for redirect to new page but it is not working for both the commands.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2005
Location: Phoenix
Posts: 29
Reputation: sypher is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
sypher's Avatar
sypher sypher is offline Offline
Light Poster

Re: request.form is not working in asp.net

  #2  
May 5th, 2005
Here's an example. Lets say you have page1.aspx with a textbox control. You want a user to click a next button, transfering to page2.aspx and writting the text out on that page.

The code for button click on page1.aspx
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
        Dim context As HttpContext = HttpContext.Current
        context.Items.Add("strFirstName", TextBox1.Text)
        Server.Transfer("page2.aspx", True)
    End Sub

The page_load for the page2.aspx:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        Dim context As HttpContext = HttpContext.Current
        Response.Write("Your First Name is: " & context.Items("strFirstName"))
    End Sub

-sypher
Reply With Quote  
Join Date: May 2005
Posts: 15
Reputation: ramareddy_dotne is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
ramareddy_dotne ramareddy_dotne is offline Offline
Newbie Poster

Re: request.form is not working in asp.net

  #3  
May 5th, 2005
thank you for your reply sypher.



ramareddy_dotne
Reply With Quote  
Join Date: May 2006
Location: London, Uk
Posts: 2
Reputation: nbp is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
nbp nbp is offline Offline
Newbie Poster

Help Re: request.form is not working in asp.net

  #4  
May 12th, 2006
I am having the same problem with a slight difference. I hope someone can help.
In my aspx page I have the following:
 <script>
  sub blah()
   For intloop = 0 To (intFieldCount - 1)
    Dim oCell As New TableCell()
    strDateLink = "<input name='" & strInputName & "' type='text' value='" & dtClosureDate.ToLongDateString & "' size='33' rows='1' class='ltk' style='border:none'  />"
    oCell.Text = strDateLink
    oRow.Cells.Add(oCell)
Next
  end sub
  </script>
A you can see I am building <input> dynamically. Let’s say that the above loops 20 times, each with a different name for the dynamic <input>. How can I transfer these 20 values?
I have the following control in the body of the page.
 <asp:Button id="btnPreCloseSumbit" OnClick="TransferFormValues" Text="Submit " runat="server"/>
   
Which calls
Sub TransferFormValues(Source As Object, E As EventArgs)
    Dim context As HttpContext = HttpContext.Current
    context.Items.Add("strFirstName", TextBox1.Text)
    Server.Transfer("body_date_closures_test_output.aspx", True)
 End Sub
      
I guess I don’t understand how to transfer the form input that has a dynamic name.
Sub Page_Load(Source As Object, E As EventArgs)
    response.Write("hello<br><br>")
    Dim context As HttpContext = HttpContext.Current
    Response.Write(context.Items("strFirstName"))
    response.Write("<br><br>...")
End Sub
-nbp
Reply With Quote  
Join Date: May 2006
Location: London, Uk
Posts: 2
Reputation: nbp is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
nbp nbp is offline Offline
Newbie Poster

Re: request.form is not working in asp.net

  #5  
May 12th, 2006
it's okay. i just relised that i had been going about this the wrong way. i am able to use the request.form("id") instead of redirect and request.

-np.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 8:26 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC