Question : webmethod return value in asp.net


 In the following code my aim is to get a value from a web method and use it for further operations inside a javascript. However I cannot do so because when I cannot somehow store the returned value in a hidden filed.

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
function webMethodCaller( ids){
         PageMethods.FormatName(ids, 
      onFormatNameSuccess, 
      onFormatNameFail, 
      onFormatNameTimeout); 
      
            
        result=document.getElementById("HiddenField1").value;
 
// i want to do something else based on result after this
}



 function onFormatNameSuccess(response)
{
      debugger;
                  
      var res="";
      
      for(var i=0,il=response.length; i<il;i++){
      res+=response[i];
      }
      
      document.getElementById("HiddenField1").value = res;

}

function onFormatNameFail (exception, ctx, methodName) 
{ 
      alert("Method:"+ methodName +"\n"+ 
            exception.get_exceptionType() +"\n"+
            exception._message); 
}
function onFormatNameTimeout () 
{ 
      alert("Timeout"); 
}








///////////////////////////////////////////////

   <form id="form1" runat="server">
        <asp:HiddenField ID="hdnReturnValue" runat="server" Value="xx" />
        <asp:HiddenField ID="HiddenField1" runat="server" />
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <input type="hidden" id="hiddnvalue" runat="server" value="" />
        <asp:ScriptManager ID="yourScriptManager" runat="server" EnablePageMethods="true">
        </asp:ScriptManager>
    </form>


the web method is the folloiwng
///////////////////////////////////////

 [WebMethod, ScriptMethod]
        static public List<String> FormatName(string featureIds)
        {
           

            string[] rawdata = featureIds.Split(new char[] { ',' });

            List<String> strings = new List<String>();
            for (int i = 0; i < rawdata.Length; i++)
            {
                strings.Add(rawdata[i]);
            }
            // strings.Add(FirstName);
            // strings.Add(LastName);*/

            //Session["result"] = strings;
            //   hdnReturnValue.value = strings;
          //  HiddenField1.Value = featureIds;
           // hiddnvalue.Value = featureIds;
            return strings;
            // LastName + ", " + FirstName;

        }

Answer : webmethod return value in asp.net

maybe you can try this:
- put the source in another directory, say, /usr/src/mysql
- remove everything in /usr/local/mysql
- then run the installation again from /usr/src/mysql
Random Solutions  
 
programming4us programming4us