Click here to Skip to main content
12,552,576 members (28,665 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET
i have textbox in updatepanel .when i enter name in textbox ,it will check whether name is in database or not.If name is exsist in database ,then near textbox massage will be display " name already exsist".
what i have to do for this?
Posted 17-Jan-13 7:26am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This isnt using an update panel but it will/should do the same thing if i understand your question correctly.


	var dataToSend={Send1:$("#IdOfYourTextBox").val(), Method:'CheckDB' };
		var opts =
			url: '<%=ResolveUrl("~/YourCodeBehindFile.aspx") %>',
			data: dataToSend,
			dataType: 'JSON',
			type: 'POST',
			success: function (response) {
				//Do something here based on if the results meet your criteria
				//Set textbox back ground color to red or something
				$("#IdOfYourTextBox").css({"background-color": "green"});

Your code behind file

protected void Page_Load(object sender, EventArgs e)
    if (!Page.IsPostBack)
        if (Request.Form["Method"] == "CheckDB")
public void CheckDB()
    //Do code here to check for name and if it exists, return a value if need be...change void to return value.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.161021.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100