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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:06:09+00:00 2026-05-17T20:06:09+00:00

neI have a DropDownList with a list of value. I need in my code

  • 0

neI have a DropDownList with a list of value.

I need in my code USE the value selected by the User in the DropDownList AS INT DataType (numeric).

At the moment I am using this code below (CONVERTING DATATYOES).
Script work just fine.

But I would like to know if exists an alternative way to do it.

Any ideas it is very appreciate. Thanks for your time.


   <asp:DropDownList ID="uxPageSizeUsersSelector" runat="server" 
    AutoPostBack="True" 
    onselectedindexchanged="uxPageSizeUsersSelector_SelectedIndexChanged">
    <asp:ListItem Value="1" Selected="True">1</asp:ListItem>
    <asp:ListItem Value="2">2</asp:ListItem>
    <asp:ListItem Value="3">3</asp:ListItem>
    <asp:ListItem Value="4">4</asp:ListItem>
</asp:DropDownList>

        int myPageSize = Convert.ToInt16(uxPageSizeUsersSelector.SelectedValue.ToString());
        PageSize = myPageSize;
  • 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-05-17T20:06:10+00:00Added an answer on May 17, 2026 at 8:06 pm

    You can use the try parse method. This will make sure that your value is an int, and if not, allow you to handle the problem instead of throwing an exception:

    int myPageSize;
    
    if(int.TryParse(uxPageSizeUsersSelector.SelectedValue, out myPageSize))
    {
         //SUCCESS
    }
    else
    {
        ///handle problem here.
    }
    

    You can do it for Int16 DateTime etc. too.

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

Sidebar

Related Questions

When you use MessageBox.Show() you have a selection of MessageBoxButtons to choose from. The
I have this string : <meis xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance uri=localhost/naro-nei onded=flpSW531213 identi=lemenia id=75 lastStop=bendi xsi:noNamespaceSchemaLocation=http://localhost/xsd/postat.xsd xsd/postat.xsd>
I have to insert some data into a MySQL table. The data will be
I call my site this way locally: http://localhost:80/mysite/de/layer1/layer2/module In .htaccess I have: RewriteEngine on
hi friends this is my xml file 1) <sDescrizione>Crociera nei fiordi</sDescrizione> 2) <sDescrizione>Fiat 500</sDescrizione>
$result=mysqli_fetch_array(mysqli_query($link, $query)); the IF MAYOR image is not working i guess there is a
I've developed an iPhone app but found out that I can't userhe ne I've
I've been programming in C-derived languages for a couple of decades now. Somewhere along
Since the CheckBox control doesn't increase the checkbox when the font size is increased,
I want to take a csv export of my bibtex literature database and analyse

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.