• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 266
  • Last Modified:

Jquery: Refreshing DropDownLists in UpdatePanel

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.
Jquery:
 function addDDLOpenDialog(orgID, tableName) {
        var divName = "#OtherMedicationDialog";
        var ajaxUrl = "CRE.aspx/AddOtherMedication";
        $(divName).dialog("destroy");
        $(divName).dialog("open");

        $(divName).dialog({
            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
                    clearForm(divName);
                    $(this).dialog('close');
                },
                Close: function (ev, ui) {
                    clearForm(divName);
                    $(this).dialog('close');
                }
            }
        });          //end of Dialog w/options
    };  //End of openDialog Function 

aspx:
 <asp:UpdatePanel ID="MedicationInfoUP" runat="server" UpdateMode="Conditional" >
                              <ContentTemplate>
                              <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
        AllergiesDS.Update()
        DietaryDS.Update()
        SpecialNeedsDS.Update()
        ImpairmentDS.Update()
        DiagnosisDS.Update()
    End Sub

Open in new window

0
Robert Treadwell
Asked:
Robert Treadwell
1 Solution
 
jagssiduralaCommented:
Also write below code

MedicationInfoUP.Update()

in your MedicalInfoUpdatePanel click event

0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now