search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Invoke _command sub from another sub (vb.net code-behind)

Asked by Ed
22 days ago.

Hi,

Is there any way to fire the DayPilotMonth_Command sub from another sub in a vb.net code-behind? I’m trying to reload the data in the monthly view after clicking a link button in an AJAX modal popup control. The button closes the modal and does some other stuff, but I would also like it to invoke the “navigate” statement in the _Command sub:

Protected Sub DayPilotMonth1_Command(ByVal sender As Object, ByVal e As CommandEventArgs)

    Select Case e.Command

        Case "navigate"
            DayPilotMonth1.StartDate = CDate(e.Data("day"))
            DayPilotMonth1.DataSource = GetData(DayPilotMonth1.VisibleStart, DayPilotMonth1.VisibleEnd)
            DayPilotMonth1.DataBind()
            DayPilotMonth1.Update()

        ' ...

    End Select

End Sub

I can sort of reload the data from a separate sub but can’t get “e.Data(“day”) - needs (I’m guessing) the “e as CommandEventArgs”.

Thanks

Answer posted by Dan Letecky [DayPilot]
21 days ago.

If you want to update the DayPilotMonth control from another control, there are the options:

  1. You can invoke commandCallBack() from the client side.

  2. You can update it using a partial PostBack, if the control is placed inside an UpdatePanel.

  3. And of course, you can update the whole page using a PostBack.

It depends on the modal popup that you are using. Invoking commandCallBack from the client side is probably the best choice, unless you are already using UpdatePanels.

New Reply
This reply is
Attachments:
or drop files here
Your name (optional):