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

  • SEARCH
  • Home
  • 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 8398779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:08:03+00:00 2026-06-09T21:08:03+00:00

So I have 2 pages. They both have the same master page and are

  • 0

So I have 2 pages. They both have the same master page and are part of the same Web Application. I am trying to submit one page to the other. On the submitting page I have a few elements such as

<ajaxToolkit:ComboBox ID="cmboOptions" AutoCompleteMode="SuggestAppend"
CaseSensitive="false" ItemInsertLocation="Append" runat="server" DropDownStyle="DropDownList">
    <asp:ListItem></asp:ListItem>
    <asp:ListItem Text="Option 1" Value="opt1"></asp:ListItem>
    <asp:ListItem Text="Option 2" Value="opt2"></asp:ListItem>
</ajaxToolkit:ComboBox>

I am using

<asp:Button ID="btnSubmit" runat="server" Text="Submit" 
PostBackUrl="~/Results.aspx" />

to submit the page.

On the results page in the code behind on page load I have

NameValueCollection nvc = Request.Form;
string selectedOption = nvc["cmboOptions"];

If I look in the NVC on debug I can see

ctl00$MainContent$cmboOptions$TextBox

with a value of “Option 1” yet my string still contains a value of null. I do not want to even bother trying to get the value by hard coding the obfuscated ID’s in and I can’t set a name property on ASP.net elements.

Does anyone know a better/proper way to accomplish what I am doing? I would like to stick with the ajaxControlToolkit comboboxes because they are nice for the user although I wish I stuck with jQuery instead of listening to my friend and now it’s too late to switch.

I looked here without any luck

Get POST data in C#/ASP.NET

and here

Read Post Data submitted to ASP.Net Form

and here

http://msdn.microsoft.com/en-us/library/6c3yckfw.aspx

and I tried PreviousPage.FindControl and I always get null.

Thanks for your time!

Edit:

Avoid the AjaxControlToolKit. It is nice if you want to be lazy and drag->drop sweet UI elements but is just a headache to get simple things working! Use jQuery.

  • 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-09T21:08:04+00:00Added an answer on June 9, 2026 at 9:08 pm

    I think you have to use Page.PreviousPage Property
    You can get the dropdown value as

    if (Page.PreviousPage != null)
    {
       DropDownList ddl= (DropDownList)Page.PreviousPage.FindControl("cmboOptions$cmboOptions_TextBox");
       // You have an AjaxToolkit Combo Box, so you must cast it as
       AjaxToolKit.ComboBox ddl= (AjaxToolKit.ComboBox )Page.PreviousPage.FindControl("cmboOptions"); 
       if (ddl != null)
       {
          // do your work
       }
    }
    

    Read more on msdn about Cross Page Posting in Asp.net

    Updated Answer:
    To check the Steve code I created a page with a dropdownlist and a button to do postback ( Currently I don’t have ajaxtoolkit so I’m using dropdownlist )

    <asp:DropDownList ID="ddl" runat="server"  >
        <asp:ListItem></asp:ListItem>
          <asp:ListItem Text="Option 1" Value="opt1"  > </asp:ListItem>
          <asp:ListItem Text="Option 2" Value="opt2"  ></asp:ListItem>
    </asp:DropDownList>
    <asp:Button ID="btnSubmit" runat="server" Text="Submit" 
        PostBackUrl="~/Default4.aspx" />
     // This code was written on Default5.aspx
    
     // Default4.aspx code behind
    protected void Page_Load(object sender, EventArgs e)
    {
        NameValueCollection nvc = Request.Form;
        string val = Request.Form["ddl"];
        string val2 = nvc["ddl"];
        // Both above statement returns the required result
    }
    

    So, i think the problem is with the Ajax Combo box.( if you are not doing any mistake )

    Updated Answer:
    The problem is that the ID of Ajax Combo box control is changed when we post the page. In the Next page we can get the ID of ajax combox box as

    For Pages Without Master Pages:
    If you are using an aspx page without master page then you can get the ID of ajax combo box as

         //Ajax Combo Box ID format
         ComboBoxID + "$TextBox" 
         // so If I have a combo box with ID ComboBox1 it becomes
         ComboBox1$TextBox
         so we will get the value as
         string comboBoxvalue = Request.Form["ComboBox1$TextBox"];
                       or
         NameValueCollection nvc = Request.Form;
         string cmbvalue = nvc["ComboBox1$TextBox"];
    

    For Pages using MasterPages:

        //Ajax Combo Box ID format
        "ctl00$" + ContentPlaceHolderID +"$" + ComboBoxID + "$TextBox"
        //I have a combox Box with ID ComboBox1 and ContentPlaceHolderID ContentPlaceHolder1
        so AjaxComboBox ID becomes ctl00$ContentPlaceHolder1$ComboBox1$TextBox
    
        string cmbvalue = nvc["ctl00$ContentPlaceHolder1$ComboBox1$TextBox"];
    
        // In your case
       // ComboxBox ID is cmboOptions  and ContentPlaceHolderID is MainContent
        // so your ID becomes
        ctl00$MainContent$cmboOptions$TextBox
        // so you will get the data as
         string cmbvalue = nvc[" ctl00$MainContent$cmboOptions$TextBox"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two CSS tranistions as below (they both cover the page and then
I have a few pages and want that they use one style. See in
I have a page where a user submits an order, and after they submit
I have two copies of same image map on page. They have different ID's,
I have two web-sites: example.com and yyy.com They both have similar web apps, but
On the Freebase website topic pages they have a section called Related Topics. So
So I have 4 pages. They are very simple. index.php (WORKS) <html> <form action=upload.php
We have a client who desires some extremely long pages. Say 4000px plus. They
I have seen stackoverflow ask question page they disable button until my postback event
I have three Divs on the page and they are absolute positioned. Lets call

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.