Solved

Click event in Visual Studio C#

Posted on 2015-02-17
9
78 Views
Last Modified: 2015-02-17
I've been researching and can't find what I'm looking for. I have a page with a drop down list. I want to select the OrderID from the dropdown list then populate text boxes on a different page based on the OrderID field from the Order table when clicking the submit button. I know I need a click event but don't know what else. Any ideas?
0
Comment
Question by:Robin Harris
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 33

Expert Comment

by:it_saige
ID: 40614871
There are many ways to transfer data between pages (Query String, Session State, HTTP Post Information, etc. etc.).

Microsoft has a TID that discusses this process and some of the options available - https://msdn.microsoft.com/en-us/library/6c3yckfw(v=vs.140).aspx

-saige-
0
 

Author Comment

by:Robin Harris
ID: 40614998
Thanks for the link.  To the source page I added this code:
          protected void btnSubmit_Click(object sender, EventArgs e)
          {

              Response.Redirect("wscOrderVerify.aspx?orderID=" + ddlOrderID.Text);

          }

Open in new window


I added the following code to the target page:

public partial class wscOrderVerify : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["OrderID"] != null)
                orderID.Text = Request.QueryString["OrderID"];
        }
    }

Open in new window


Right now I just want to pass the OrderID selected from the drop down (ddlorderID) and fill the orderID text box on the target page. With the code above nothing happens when I click the submit button.
0
 
LVL 33

Expert Comment

by:it_saige
ID: 40615014
That's because it is case sensitive.  Either use OrderID or orderID for all references.

-saige-
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Robin Harris
ID: 40615044
Ahh yes I'm punching myself for missing that. I made the change all references say orderID. The target page still doesn't load when clicking submit. I don't receive any error messages either.
0
 
LVL 33

Expert Comment

by:it_saige
ID: 40615107
It works for me.  I have attached a test solution.

-saige-
EE-Q28618631.zip
0
 
LVL 33

Accepted Solution

by:
it_saige earned 500 total points
ID: 40615128
And for completeness, here is a version using a DDL.

-saige-
EE-Q28618631.zip
0
 

Author Comment

by:Robin Harris
ID: 40615210
Don't know how but I was missing onclick="btnSubmit_Click". I apologize for the noob questions. I've spent the last 24 hours reading up on ASP.Net and C#. I haven't looked at this stuff in 2 years. Thanks a ton for your help.
0
 

Author Closing Comment

by:Robin Harris
ID: 40615213
Excellent job. The expert was very patient with me. Thanks again.
0
 
LVL 33

Expert Comment

by:it_saige
ID: 40615247
No worries.  Glad you were able to get it sorted out.

-saige-
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question