Custom control and ClientScript.GetPostBackEventReference RRS feed

  • Question

  • User-634781587 posted


    I have developed a custom control asp.net/jquery that I am now implementing. The custom control is a dialog that will pop up on a button click. The button won't post back until the user has clicked one of the buttons in the dialog (Yes/No/Cancel). To achieve this I have used

    Page.ClientScript.GetPostBackEventReference(button, string.Empty);

    This worked great until I implemented the dialog as a custom control. Now I get a null reference exception from the code below (line 2).


    HiddenField postback = (HiddenField)JDialog.FindControl("postback");

    postback.Value = Page.ClientScript.GetPostBackEventReference(button, string.Empty); 


    The only difference is that I cannot refer directly to the hiddenfield used for postback since it is inside the custom control. Using FindControl has nothing to do with the null reference though since it is thrown on line 2...







    Monday, May 18, 2009 8:23 AM

All replies

  • User-2106054853 posted


    Could you post a demo that can reproduce this problem?

    Wednesday, May 20, 2009 11:27 PM