Click to See Complete Forum and Search --> : [Resolved] Basic problem
naruponk
Apr 3rd, 2005, 05:11 AM
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
mendhak
Apr 3rd, 2005, 05:39 AM
What does your <form> code look like? (Show more)
How are you trying to access the values in page 2?
naruponk
Apr 3rd, 2005, 10:45 PM
<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 :)
mendhak
Apr 4th, 2005, 12:25 AM
Use Request.Form(), not Session().
naruponk
Apr 4th, 2005, 05:47 AM
Why when i press a submit button, in URL address is still aspx1.aspx? :mad:
I have set action=aspx2 so URL address should shows aspx2.aspx
mendhak
Apr 4th, 2005, 05:51 AM
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"?
naruponk
Apr 4th, 2005, 06:43 AM
currently using <input type="submit"> What should i do?
how about asp:button?
mendhak
Apr 4th, 2005, 06:46 AM
Strange. Assuming that's the code you showed me, it shouldn't be like that. :confused:
Post more code?
naruponk
Apr 4th, 2005, 07:18 AM
Sorry, This is HTML Code :bigyello:
<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>
mendhak
Apr 4th, 2005, 07:25 AM
Remove the runat="server" from the <form> tag.
naruponk
Apr 4th, 2005, 10:57 PM
Thanks it works! :bigyello:
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" :confused:
mendhak
Apr 5th, 2005, 12:19 AM
if (Convert.ToString(Session["Test"])=="Test")
{
TextBox1.Text="Test Successfully";
}
naruponk
Apr 5th, 2005, 02:46 AM
Got it thanks a lot mendhak :wave:
What's advantage of runat=server tag?
mendhak
Apr 5th, 2005, 04:22 AM
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:
<input type="text" id="txtUserName" runat="server">
You could then work with it in your .vb file like so:
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!
naruponk
Apr 5th, 2005, 05:46 AM
Thanks a lot mendhak :thumb: :wave:
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.