Geeks With Blogs
AngelEyes on .Net Tips, tricks and WTFs about Asp .Net, SQL Server and the likes.

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 on Saturday, June 27, 2009 3:16 PM | Back to top


Comments on this post: Manually postback

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © AngelEyes | Powered by: GeeksWithBlogs.net