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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:16:51+00:00 2026-06-14T10:16:51+00:00

I have a Serverside code in Java and client pages in .Net. Now I

  • 0

I have a Serverside code in Java and client pages in .Net. Now I have to load a dropdown list in .Net from a serverside action class in Java. To do this, I created a asp dropdownlist as shown:

<asp:DropDownList ID="invoiceYear" runat="server" OnLoad='<%#GetYearRange()%>'  
    Width="150px" AutoPostBack="True">
</asp:DropDownList>

and I have a method GetYearRange in aspx.cs as shown:

[WebMethod]
public static string GetYearRange()
{
    System.Diagnostics.Debug.WriteLine("I am in");
    string strNewValue = "page=" + "" + "&rows=" + "" + "&sort=" + "" + "&order=" + ""; 
    string ss = ServerUtil.getServerString(strNewValue, "/invoice/invoice!getYearRange.action");
    System.Diagnostics.Debug.WriteLine("ss-->" + ss);
    return ss;
}

it is not going to that method. Please advice me how would I get the results from this method into my dropdownlist??

  • 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-14T10:16:52+00:00Added an answer on June 14, 2026 at 10:16 am

    It should not be decorated with the [WebMethod] attribute, and you also are not calling the method correctly. If you want to have this bind itself with values you need to set its DataSource to a proper collection. If you are trying to set its current selected value you will need to set that specifically. The real question I would have is: What are you trying to do with this code?

    If you are attempting to load the dropdownlist with values received from your service call:

    protected void Page_Load(object sender, EventArgs e)
    {
        // GetYearRange() will have to return at least a string[]
        // It would be better if it was a ListItem[] or a List<ListItem>
        invoiceYear.DataSource = GetYearRange();
        invoiceYear.DataBind();
    }
    

    If you already have it DataBound but you need to force the selected item to be the result of your service, you need to use the OnDataBound event:

    <asp:DropDownList ID="invoiceYear" runat="server" OnDataBound="invoiceYear_DataBound"  
        Width="150px" AutoPostBack="True">
    </asp:DropDownList>
    
    ...
    
    protected void invoiceYear_DataBound(object sender, EventArgs e)
    {
         invoiceYear.SelectedValue = GetYearRange();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code that creates a serverside object of the xmlhttp class.
I have a server-side code using .NET Remoting to establish the connection with client.
If I have pages having server-side code in code-behind, then I know that the
I have a client/server application in Java, which communicate by serialize/deserialize objects. Typically client
I have an existing Java client that I need to build a web service
I have been requested by a client to pull the latest posts from their
As an extension of Java ClassNotFoundException when reading object from a stream I have
I have a project in Flex (client) and Java red5 that I would like
I have a Java-based server side and a flex client side using Spring BlazeDS
I'm migrating from server side development (java, php) to client side - HTML, CSS,

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.