Manually postback

I wanted to post back after an auto complete extender did its job. This was the first version (the auto complete extender showed student names).

Server-side:

    protected override void OnPreRender(EventArgs e)

    {

        base.OnPreRender(e);

        if (!Page.ClientScript.IsClientScriptBlockRegistered("postBackStudentFound"))

        {

            Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "postBackStudentFound",

                @"<script type=""text/javascript"">function postBackStudentFound() {" +

                 Page.ClientScript.GetPostBackEventReference(this.Page, StudentFoundEventArg) + "; } </script>");

        }

        if (Page.IsPostBack)

        {

            if (Request["__EVENTARGUMENT"] == StudentFoundEventArg)

            {

                OnStudentFound();

            }

        }

    }

Client-side:

<script type="text/javascript">

function itemSelected( source, eventArgs)

{
    var fullString = eventArgs.get_value();
    var valuesArray = fullString.split("|");
    var id = valuesArray[0];
    var key = valuesArray[2];

    $get('<%= txtID.ClientID %>').value = id;  

    postBackStudentFound();

}
</script>

posted @ Saturday, June 27, 2009 3:16 PM

Print

Comments on this entry:

No comments posted yet.

Your comment:



 (will not be displayed)


 
 
 
 

Live Comment Preview:

 
«November»
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345