Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8464265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:41:34+00:00 2026-06-10T14:41:34+00:00

I have a user control which opens as a modal popup on a child

  • 0

I have a user control which opens as a modal popup on a child page.
There is a text box in the popup which I am validating for duplicate values for that I have written the following server- and client-side functions.

function Check_DuplicateMachineType() {
    var hndDuplicateMachineType = document.getElementById('<%= hndDuplicateMachineType.ClientID %>');
    var txtmachineType = document.getElementById('<%= txtmachineType.ClientID %>');
    if (txtmachineType.value.trim() != '' && txtmachineType.value.trim().toLowerCase() != hndDuplicateMachineType.value) {
        $.ajax({
            type: "POST",
            url: "wucMachineType.ascx/CheckDuplicateMachineType",
            data: '{Item: "' + $("#<%=txtmachineType.ClientID%>")[0].value + '" }',
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: OnSuccessForMachineType,
            failure: function(response) {
                alert(response);
            }
        });
    }
}
function OnSuccessForMachineType(response) {        
    var txtmachineType = document.getElementById('<%= txtmachineType.ClientID %>');
    var divMachineTypes = document.getElementById('<%= divMachineTypes.ClientID %>');
    divMachineTypes.innerHTML = '';
    switch (response.d) {
        case "true":
            divMachineTypes.style.display = "inline";
            divMachineTypes.innerHTML = "Machine Type already exist";
            $("#<%=divMachineTypes.ClientID%>")[0].focus();
            $("#<%=hndIsDuplicate.ClientID%>")[0].value = '1';
            break;
        case "false":
            $("#<%=hndIsDuplicate.ClientID%>")[0].value = '0';
            break;
        case "error":
            divMachineTypes.style.display = "inline";
            divMachineTypes.innerHTML = "Error occured";
            break;
    }
}
[System.Web.Services.WebMethod]
public static string CheckDuplicateMachineType(string Item)
{
    CommonClass objCLSCommon = new CommonClass();
    DataLayer dtLayer = new DataLayer();
    try
    {
        string strQuery = "SELECT machineType from MachineType Where machineType ='" + Item + "'";
        DataTable dtCheckDuplicacy = dtLayer.Get_GeneralData(strQuery);
        if (dtCheckDuplicacy.Rows.Count > 0)
        {
            return "true";
        }
        else
        {
            return "false";
        }
    }
    catch (Exception ex)
    {
        objCLSCommon.LogErrorToFile(objCLSCommon.GetCurrentPageName(), ex.Message.Trim() + Environment.NewLine + ex.StackTrace.Trim());
        return "";
    }
}

I don’t know why my wucMachineType.ascx/CheckDuplicateMachineType function is not being called.
Also there is no error in the error console.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:41:36+00:00Added an answer on June 10, 2026 at 2:41 pm

    [Web Methods] dose not call which is written on user control(.ascx file) .That’s the mistake i am doing.

    [Web Methods] must be written on aspx page. (.aspx file).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data navigation user control in Silverlight which opens a child window
I have a nested user control which appears on every single page. It contains
I have a user control which displays the currently logged in user's name. I
I have a user control which uses objects as inner properties (some code is
I have a user control which is 2 RadCombos cascaded. I'm trying to add
I have a user control which has a DateTimePicker overlaid with the single line
I have developed a user-control which gets bound to an id-field and then enables
I have a wpf user control which exposes an IEnumerable ItemsSource DependencyProperty. I bind
I have created a user control (link) which has a label and a button.
i have user control, which i render on several views. i want to show

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.