Jquery: Refreshing DropDownLists in UpdatePanel

Posted on 2011-10-11
Last Modified: 2012-06-22
I have been trying for days to call my vb code from jquery function.  I am getting the Panel to update but call is not being made see code below and please advise.
 function addDDLOpenDialog(orgID, tableName) {
        var divName = "#OtherMedicationDialog";
        var ajaxUrl = "CRE.aspx/AddOtherMedication";

            autoOpen: "false",
            title: "Add List Value",
            width: 500,
            height: 235,
            modal: true,

            //Define Buttons
            buttons: {
                Submit: function () {
                    var newValue = "";
                    newValue = $("#<%= omDialogTB.ClientID  %>").val();
                    //Submit form by calling webservice
                    $.ajax({ type: 'POST',
                        url: ajaxUrl,
                        data: '{orgID:"' + orgID + '", tableName:"' + tableName + '", newValue:"' + newValue + '"}',
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function (msg) {
                            if (msg.d) {
                                //"ClientScript.GetPostBackEventReference(btnRefreshDDL, '')";
                                __doPostBack('<%= btnRefreshDDL.ClientID%>', '');
                        error: function () {
                            alert("Error! Try again...");
                    //Now close dialog
                Close: function (ev, ui) {
        });          //end of Dialog w/options
    };  //End of openDialog Function 

 <asp:UpdatePanel ID="MedicationInfoUP" runat="server" UpdateMode="Conditional" >
                              <asp:LinkButton runat="server" ID="btnRefreshDDL" OnClick="MedicalInfoUpdatePanel" style="display: none;" />
                                <div class="MIContent">                          
                                <!-- Beginning of Fieldset -->

Code behind:
 Protected Sub MedicalInfoUpdatePanel(ByVal sender As Object, ByVal e As System.EventArgs)
        'Retrieve Data from LINQ Datasource
        Dim db As ClientInfoDataContext = New ClientInfoDataContext
        'check to see if userID already exist.  If So then Basic Record exist already only updates are necessary
        'return userID by providing BadgeID
        Dim userID As String = ""
        If Not (String.IsNullOrEmpty(Request.QueryString("ID"))) Then
            userID = Request.QueryString("ID").ToString()
        End If
    End Sub

Open in new window

Question by:Robert Treadwell
    1 Comment
    LVL 12

    Accepted Solution

    Also write below code


    in your MedicalInfoUpdatePanel click event


    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
    This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now