Need to call server side event using __doPostBack
Asked Answered
G

1

5

I have server side event like this.

protected void RadTreeView1_ContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e)
    {
         // implementation here.
    }

I am trying to call it from client side javascript. I have tried __doPostBack("contextMenuItemID", "some string")

it posts the page back to server, but this does not invoke the original ContextMenuItemClick event. How can I invoke the original contextMenuItemClick event with proper event Args?

Ganymede answered 7/5, 2012 at 13:48 Comment(0)
R
7

You'll want to look at using the ClientScriptManager.GetPostBackEventReference method. This will create the correct javascript call ("__doPostBack") for the control/action using the ClientScriptManager (untested example):

<script type="text/javascript">
    function callPostBack() {
        <%= Page.ClientScript.GetPostBackEventReference(RadTreeView1, String.Empty) %>;
    }
</script>
Readily answered 7/5, 2012 at 13:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.