request.form is not working in asp.net

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2005
Posts: 15
Reputation: ramareddy_dotne is an unknown quantity at this point 
Solved Threads: 0
ramareddy_dotne ramareddy_dotne is offline Offline
Newbie Poster

request.form is not working in asp.net

 
0
  #1
May 2nd, 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.
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 29
Reputation: sypher is an unknown quantity at this point 
Solved Threads: 0
sypher's Avatar
sypher sypher is offline Offline
Light Poster

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

 
0
  #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
  1. Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
  2. Dim context As HttpContext = HttpContext.Current
  3. context.Items.Add("strFirstName", TextBox1.Text)
  4. Server.Transfer("page2.aspx", True)
  5. End Sub

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

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

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

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



ramareddy_dotne
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 2
Reputation: nbp is an unknown quantity at this point 
Solved Threads: 0
nbp nbp is offline Offline
Newbie Poster

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

 
0
  #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:
  1. <script>
  2. sub blah()
  3. For intloop = 0 To (intFieldCount - 1)
  4. Dim oCell As New TableCell()
  5. strDateLink = "<input name='" & strInputName & "' type='text' value='" & dtClosureDate.ToLongDateString & "' size='33' rows='1' class='ltk' style='border:none' />"
  6. oCell.Text = strDateLink
  7. oRow.Cells.Add(oCell)
  8. Next
  9. end sub
  10. </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.
  1. <asp:Button id="btnPreCloseSumbit" OnClick="TransferFormValues" Text="Submit " runat="server"/>
Which calls
  1. Sub TransferFormValues(Source As Object, E As EventArgs)
  2. Dim context As HttpContext = HttpContext.Current
  3. context.Items.Add("strFirstName", TextBox1.Text)
  4. Server.Transfer("body_date_closures_test_output.aspx", True)
  5. End Sub
I guess I don’t understand how to transfer the form input that has a dynamic name.
  1. Sub Page_Load(Source As Object, E As EventArgs)
  2. response.Write("hello<br><br>")
  3. Dim context As HttpContext = HttpContext.Current
  4. Response.Write(context.Items("strFirstName"))
  5. response.Write("<br><br>...")
  6. End Sub
-nbp
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 2
Reputation: nbp is an unknown quantity at this point 
Solved Threads: 0
nbp nbp is offline Offline
Newbie Poster

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

 
0
  #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 Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC