PDA

View Full Version : dhtml hidded div - javascript pagemethods



rpdco
05-13-2011, 05:55 PM
I have a dhtml hidded div that contains a button that on-click runs a javascript function that passes form info to a server-side webmethod function(vb.net).

Everything works fine with IE and Chrome, but when using Firefox the server-side webmethod is not executed.

All the other code within the javascript seems to execute, but not the pagemethod.

Simplified Client Side [CODE]:

<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"/>

<div id="divAddToPartsList" style="display:none;">
<p style="text-align:right;padding:10px;"><asp:Button id="btnAddToPL" runat="server" Text="Add" width="100px"></asp:Button>
</div>



<script type="text/javascript">
function AddMe(custpn, custnote, askpn) {
var pn = document.getElementById(custpn);
var note = document.getElementById(custnote);
var ask = document.getElementById(askpn);

// call server side method
PageMethods.UpDateUserParts(pn.value, note.value, ask.checked);

ModalPopUp.hide();

location.reload(true);

}
</script>


Very Simplified Server [CODE]:

btnAddToPL.Attributes.Add("onclick", "javascript:AddMe('" & txtCustPN.ClientID & "', '" & txtCustNote.ClientID & "' , '" & cbNoCustPN.ClientID & "')")



<WebMethod()> _
Public Shared Function UpDateUserParts(ByVal custPN As String, ByVal custNote As String, ByVal askpn As String)

'**lines removed to keep it short

Return ""
End Function


Thanks,

Pat

rpdco
05-13-2011, 09:25 PM
Problem solved.

Javascript needed some adjustments to work correctly with Firefox.