문제

I am now working on PageMethods. Almost I have all the problems raised by PageMethods. But I couldnot pass dropdownlist's id as a parameter. The following is my javascript and webmethod

Javascript:

var ddlpf=document.getElementById('<%=ddlpf.ClientID%>');
PageMethods.updateDrop(ddlpf, "select_portfolio", para, "pfname", "pfid", true, "--Select--",OnSucess,OnFail);

WebMethod:

<WebMethod()> _
    <ScriptMethod()> _
Public Shared Function updateDrop(ByVal cboname As DropDownList, ByVal spname As String, ByVal para1 As Object, ByVal dismem As String, ByVal valmem As String, ByVal wsel As Boolean, ByVal wseltext1 As String) As Boolean
    loadcombo(cboname, spname, para1, dismem, valmem, wsel, wseltext1)
    Return True
End Function

It is not working. Can anyone guide me to achieve this?

도움이 되었습니까?

해결책

First you have to return an array from the web method. then update it to the dropdown.

PageMethods.updateDrop("select_portfolio", para, "pfname", "pfid", true, "--Select--",'a',false,null,OnSuccess,OnFail);
function OnSuccess(response)
{
ddlpf.options.length=0;
for(i=0;i<response.length;i=i+2)
{
var ddloption=new Option(response[i],response[i+1]);
ddlpf.options.add(ddloption);
}
}
function onFail(){}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top