|
-
Apr 3rd, 2005, 05:11 AM
#1
Thread Starter
Hyperactive Member
[Resolved] Basic problem
Hi,
i have 1 aspx named as "aspx1" i have created 1 textbox and 1 button.
when i click a button how to pass a parameter in textbox to aspx2.aspx?
I insert action=aspx2.aspx in <Form ....>.
then i run and click the button i have seen no action from them.
what's wrong? do i need to coding in codebehind file?
Thanks for advance
Last edited by naruponk; Apr 5th, 2005 at 05:46 AM.
-
Apr 3rd, 2005, 05:39 AM
#2
Re: Basic problem
What does your <form> code look like? (Show more)
How are you trying to access the values in page 2?
-
Apr 3rd, 2005, 10:45 PM
#3
Thread Starter
Hyperactive Member
Re: Basic problem
<form id="Form1" method="post" runat="server" action="aspx2.aspx">
I have set a session in code behind file of aspx1.aspx, i just want to test that how to pass a parameter to aspx2
below is a code of event Page_Load on aspx2
TextBox1.Text=Convert.ToString(Session["Test"]);
Thanks for reply
Last edited by naruponk; Apr 4th, 2005 at 05:45 AM.
-
Apr 4th, 2005, 12:25 AM
#4
Re: Basic problem
Use Request.Form(), not Session().
-
Apr 4th, 2005, 05:47 AM
#5
Thread Starter
Hyperactive Member
Re: Basic problem
Why when i press a submit button, in URL address is still aspx1.aspx?
I have set action=aspx2 so URL address should shows aspx2.aspx
-
Apr 4th, 2005, 05:51 AM
#6
Re: Basic problem
Depends. What sort of a submit button is it? Is it an <input type="submit"> or is it an asp:button with the text "Submit"?
-
Apr 4th, 2005, 06:43 AM
#7
Thread Starter
Hyperactive Member
Re: Basic problem
currently using <input type="submit"> What should i do?
how about asp:button?
-
Apr 4th, 2005, 06:46 AM
#8
Re: Basic problem
Strange. Assuming that's the code you showed me, it shouldn't be like that. 
Post more code?
-
Apr 4th, 2005, 07:18 AM
#9
Thread Starter
Hyperactive Member
Re: Basic problem
Sorry, This is HTML Code
<form id="Form1" method="post" runat="server" action="aspx2.aspx">
<INPUT style="Z-INDEX: 101; LEFT: 304px; POSITION: absolute; TOP: 160px" type="submit" value="Submit"> </form>
-
Apr 4th, 2005, 07:25 AM
#10
Re: Basic problem
Remove the runat="server" from the <form> tag.
-
Apr 4th, 2005, 10:57 PM
#11
Thread Starter
Hyperactive Member
Re: Basic problem
Thanks it works!
Below is code in Page_load event on aspx2
if (Convert.ToString(Session["Test"])="Test")
{
TextBox1.Text="Test Successfully";
}
I got an error that "Cannot implicitly convert type string to bool"
-
Apr 5th, 2005, 12:19 AM
#12
Re: Basic problem
PHP Code:
if (Convert.ToString(Session["Test"])=="Test")
{
TextBox1.Text="Test Successfully";
}
-
Apr 5th, 2005, 02:46 AM
#13
Thread Starter
Hyperactive Member
Re: Basic problem
Got it thanks a lot mendhak
What's advantage of runat=server tag?
-
Apr 5th, 2005, 04:22 AM
#14
Re: Basic problem
When you use runat="server", it means you want it to be accessible in your codebehind.
As a simple example, if you place a textbox on the page like so:
Code:
<input type="text" id="txtUserName" runat="server">
You could then work with it in your .vb file like so:
Code:
Me.txtUserName.Text = "Something"
You had the runat="server" attribute in your form tag, which meant it was a server side tag, and that was causing the problems. But to tell you the truth, I'm not sure why. It's often the case, gotta be careful with them runat="server" attributes!
-
Apr 5th, 2005, 05:46 AM
#15
Thread Starter
Hyperactive Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|