Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,

I have to get string values from my resource folder using Web Service.It should be in the format of dictionary i.e, dictionary (string,string)>..So, i have written code for Web Method.
C#
[WebMethod]
    public void Dictionary()
    {
        Dictionary<string,string> wordPairs = new Dictionary<string,string>();
        string englishword;
        wordPairs.TryGetValue("malayword", out englishword);
    }

-----------------------

Now my problem is, i have to get the value of other string(which is in bold) into a text box(using another web form) using a drop down list(event:onselect_indexChanged)....

Please guide me....
Posted
Updated 5-Jan-11 9:51am
v5

Dear, you have to return your desired value as string like this:

MIDL
[WebMethod]
    public string Dictionary()
    {
        Dictionary<string,string> wordPairs = new Dictionary<string,string>();
        string englishword;
        wordPairs.TryGetValue("malayword", out englishword);

        return englishword;
    }
 
Share this answer
 
Comments
Ashwin Kollaram 5-Jan-11 16:09pm    
Thank you..then what about the drop down and textbox
fjdiewornncalwe 7-Jan-11 10:25am    
+5 for answering his question and fixing his code error.
welll, ..you will need to add a Web Reference to your project with the service, and just write the code:

C#
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
    localhost.Service1 myservice = new localhost.Service1();
    TextBox1.Text = myservice.Dictionary;

}


Regards;
 
Share this answer
 
Comments
fjdiewornncalwe 7-Jan-11 10:26am    
+5 for answering his second question.
Note: In the future, instead of inserting a second answer, just click on the "Improve Answer" link on your other answer so that the thread makes more sense to people. The change to your answer then would be associated to the OP's comment and everyone else can follow better.
Ali Al Omairi(Abu AlHassan) 1-Feb-11 18:05pm    
Thank you, Marcus. As you maight know I am still new to the CP; I don't know much about using its features.
by the way, what is the OP's?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900