Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9000759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:21:01+00:00 2026-06-16T00:21:01+00:00

I trying asp.net and trying posting data from one page to other. It was

  • 0

I trying asp.net and trying posting data from one page to other. It was so easy in PHP .
I have two aspx web pages Page1.aspx and Page2.aspx

Page1.aspx has a drop downlist in which i select an option and on clicking submit button , this value should be passed to Page2.aspx and captured by its codebehindfile Page2.aspx.cs by Request.Form[].

Page1.aspx

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Page1.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
</head>
<body>  

    <form id="form1" runat="server" method="post" action="Page2.aspx">

<asp:DropDownList id="DropDownList1" runat="server" >

<asp:ListItem value="">Select</asp:ListItem>
<asp:ListItem value="1">Hello</asp:ListItem>
<asp:ListItem value="2">World</asp:ListItem>
</asp:DropDownList>



<asp:Button  runat="server"  />  
      </form>  
    </body>
    </html>

How to pass value from Page1.aspx? What am I doing wrong in the form tag? What is the alternative method?
What should I do in Page2.aspx to capture the selected value from the drop-down list?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:21:02+00:00Added an answer on June 16, 2026 at 12:21 am

    First of all there are lot of difference while working on .net from PHP.
    use this link for better understanding.
    http://net.tutsplus.com/tutorials/asp-net/asp-net-for-php-developers-part-2/

    For your question change few things.

      <form id="form1" runat="server">
    

    1) don’t use the action here, we will use the button click for that.

    <asp:button id="btnSubmit" onclick="btnSubmit_OnClick" Text="Click Me" Runat="server"></asp:button>
    

    2)Change the button ,to this and create an event for button click on Page1.aspx.cs

    protected void btnSubmit_OnClick(object sender, EventArgs e)
    {
    if (DropDownList1.SelectedItem.Value.Length > 0)
    {
                    Response.Redirect("Page2.aspx?SelectedValue=" + DropDownList1.SelectedValue);
    }
    }
    

    3) On button click check if any value is selected, If selected take the value and pass it on the second page via QueryString.

    On Page2.aspx.cs

        protected void Page_Load(object sender, EventArgs e)
        {
              string v = Request.QueryString["SelectedValue"];
         }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.Net MVC application. I am trying to post data to an
I'm trying to developing asp.net web sites.according to requirement i have to get some
I have an ASP.NET MVC Form, but the data from it needs to be
I'm porting a website from PHP to ASP.NET MVC, and I'm trying to mimic
I'd been trying to scrape some date from as asp.net website, the start page
I'm trying to create ASP.NET MVC Application with Entity Framework, which has One to
I'm trying to use ASP.net profiles I've followed some instructions which means I have
Using ASP.NET MVC when trying to get the information stored on my Session[objectName] from
I am trying to migrate a simple WinForms app to a ASP.Net web app.
I was trying the ASP.Net MVC 4 tutorial . When I have added the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.