943,699 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 60663
  • ASP.NET RSS
May 2nd, 2005
0

request.form is not working in asp.net

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ramareddy_dotne is offline Offline
15 posts
since May 2005
May 5th, 2005
0

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

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
ASP.NET Syntax (Toggle Plain Text)
  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:
ASP.NET Syntax (Toggle Plain Text)
  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
Reputation Points: 13
Solved Threads: 0
Light Poster
sypher is offline Offline
29 posts
since May 2005
May 5th, 2005
0

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

thank you for your reply sypher.



ramareddy_dotne
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ramareddy_dotne is offline Offline
15 posts
since May 2005
May 12th, 2006
0

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

I am having the same problem with a slight difference. I hope someone can help.
In my aspx page I have the following:
ASP.NET Syntax (Toggle Plain Text)
  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.
ASP.NET Syntax (Toggle Plain Text)
  1. <asp:Button id="btnPreCloseSumbit" OnClick="TransferFormValues" Text="Submit " runat="server"/>
Which calls
ASP.NET Syntax (Toggle Plain Text)
  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.
ASP.NET Syntax (Toggle Plain Text)
  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
nbp
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nbp is offline Offline
2 posts
since May 2006
May 12th, 2006
0

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

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.
nbp
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nbp is offline Offline
2 posts
since May 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Computer Registration for Public Wireless Network
Next Thread in ASP.NET Forum Timeline: how to use a javascript menu in asp.net





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC