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 8152361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:41:28+00:00 2026-06-06T15:41:28+00:00

I have the following markup / code block in the ASPX file. The binding

  • 0

I have the following markup / code block in the ASPX file.
The binding of the ddl is triggered after Page_Load event which is in the code behind file.
This results me not able to get the selected value of the dropdownlist if I were to use such flow.

However for some purpose I require it to work this way.
Any idea how I could get the dropdownlist selected value when a post back is being triggered (click of the button)?

Page URL: page.aspx?para1=0&para2=value

ASPX PAGE

<% 
    if (Convert.ToInt32(Request.QueryString["para1"]) == 0)
    {
        ddl.DataValueField = "value"; 
        ddl.DataTextField = "text"; 
        ddl.DataSource = ds; //ds is valid, exact code not shown
        ddl.DataBind(); 
    } else {
        //write in this area
        Response.Write("Not 0");
    }
%> 
<form runat="server" id="user_form" class="form-horizontal"> 
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> 
</asp:ToolkitScriptManager> 
<asp:UpdatePanel ID="updPanel" runat="server"> 
    <ContentTemplate> 
        <asp:DropDownList runat="server" ID="ddl"> 
        </asp:DropDownList> 
        <%-- this button will call btnSave_Click to get the ddl's value--%>
        <asp:Button runat="server" ID="btn" Text="Button" OnClick="btn_Click" />
    </ContentTemplate> 
</asp:UpdatePanel> 
</form> 

CODE BEHIND

protected void Page_Load(object sender, EventArgs e) 
{ 
    if (!IsPostBack) 
    { 
        //do my stuff 
    } 
} 

protected void btn_Click(object sender, EventArgs e) 
{ 
    int intValue = Convert.ToInt32(ddl.SelectedValue); 
    //do my stuff 
} 

The ASPX Page code block will run after Page_Load / page’s lifecycle, then will determine what to do base on the url parameters.
Thanks in advance!

  • 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-06T15:41:29+00:00Added an answer on June 6, 2026 at 3:41 pm

    You could always throw in a hidden object and use jquery to copy the value to the hidden value based on a certain action without a postback and would do it client side like it sounds like you want it to do

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following XAML markup in a WPF DataGrid: <DataGrid ItemsSource={Binding ResultList} Grid.ColumnSpan=4
To those jQuery experts out there. I have the following markup and code: <html>
I have the following snippet of code of which I do not have access
I have the following markup code in my page: <div id=root_img style=width:100%;height:100%> <div id=id_immagine
I have the following HTML markup: <div id=step1 class=step> <h1>Enter code</h1> <p><input type=text value=<%=
I have the following markup: <input id=displayBuffer type=hidden> <textarea id=about rows=2 name=about cols=20 aria-hidden=true><p>test</p></textarea>
I have the following markup:- <select name=a id=a> <option>Option 1</option> <option>Option Bottom</option> <option>Option 2</option>
I have the following markup that is used to produce a pop-up style mega-menu
I have the following markup, <ul id=menu> <li><a href=#>Something1</a></li> <li><a href=#>Something2</a></li> <li><a href=#>Something3</a></li> <li><a
I have the following markup: <div id=routes> <ul id=routesList> <li class=routes>Route 1</li> <li class=routes>Route

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.