Hi,
I have been working on this issue for the past few days and I appear to be no closer to solving it.
Let me explain my situation, I am working on a project that requires 2 interconnected (but seperate) modules working on the same page.
When I say 'interconnected' they essentially share some session objects and shared controller class objects.
The problem is that whilst I can get custom postbacks to work in one module on the page, I am unable to get them working on the second module. I followed the exact same steps (even cut and pasted) the code from one module to the other but the second module will not fire the server side postback event handler function.
I have stepped into the javascript and it appears to go through the motions of dnn.callpostback but the server side event simply does not fire.
I tried RaiseClientAPICallbackEvent and this works without a problem on the second module but I need to pass a simple client side gridview textbox value to the server side event and I canot do this using the RaiseClientAPICallbackEvent.
My server side module code:
Partial Class ViewGlobalCatalogue_BasketInherits Entities.Modules.PortalModuleBaseImplements Entities.Modules.IActionableImplements IClientAPICallbackEventHandlerPrivate BasketItems As New List(Of BasketItemInfo)
'Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load, Me.LoadTry
InitClientAPI()
Me.BasketItems = Session(BasketSessionObject)Me.gvBasket.DataSource = BasketItemsMe.gvBasket.DataBind()Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(
Me, exc)End Try
End Sub
Protected Sub gvBasket_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvBasket.RowDataBoundDim btnEditCartItem As ImageButton = e.Row.FindControl("btnEditCartItem")If (Not IsNothing(btnEditCartItem)) Then
btnEditCartItem.Attributes.Add(
"onclick", "return doUpdateCartItemQtyPostback('" & DataBinder.Eval(e.Row.DataItem, "ItemId") & "','" & e.Row.FindControl("txtQty").UniqueID & "," & "','" & DataBinder.Eval(e.Row.DataItem, "Description") & "');")End If
End Sub
Protected Sub InitClientAPI()If ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.XMLHTTP) _AndAlso ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.XML) Then
ClientAPI.RegisterClientReference(
ClientAPI.RegisterClientReference(
Me.Page, ClientAPI.ClientNamespaceReferences.dnn_xml)Me.Page, ClientAPI.ClientNamespaceReferences.dnn_xmlhttp)'Register External js file
If Not ClientAPI.IsClientScriptBlockRegistered(Me.Page, "GlobalCatalogue_Basket.Core.js") Then
ClientAPI.RegisterClientScriptBlock(
Me.Page, "GlobalCatalogue_Basket.Core.js", _"<script src=""" & Me.ModulePath & "GlobalCatalogue_Basket.Core.js""></script>")End If
End If
ClientAPI.RegisterPostBackEventHandler(
Me, "EditBasketQty", AddressOf EditBasketQtyPostBack, False)End Sub
BasketController.Refre****em(ItemId, Description, Qty, Context)
Private Sub EditBasketQtyPostBack(ByVal args As ClientAPIPostBackEventArgs)Dim ItemId As Integer = CInt(args.EventArguments("itemid"))Dim Qty As Integer = CInt(args.EventArguments("qty"))Dim Description As String = args.EventArguments("description")Dim BasketController As New GlobalCatalogue_BasketControllerEnd Sub
OnChangeBasketQty(
Public Function RaiseClientAPICallbackEvent(ByVal eventArgument As String) As String _Implements UI.Utilities.IClientAPICallbackEventHandler.RaiseClientAPICallbackEventDim args() As String = Split(eventArgument, ",")New AddToCartEventArgs(args(0), args(1)))Return eventArgumentEnd Function
Public Overridable Sub OnChangeBasketQty(ByVal e As AddToCartEventArgs)RaiseEvent ChangeBasketQty(Me, e)End Sub
Public Event ChangeBasketQty(ByVal sender As Object, ByVal e As AddToCartEventArgs)
End Class
My Javascript code:
// Custom Postback for adjusting basket Qty
function
doUpdateCartItemQtyPostback(itemid,qtycontroluniqueid,description) {
var
dnn.callPostBack(
}
Any assistance would me much appreciated as this is driving me insane.
qty = document.getElementById(qtycontroluniqueid);'EditBasketQty', 'itemid=' + itemid,'qty=' + qty.value, 'description=' + description);