Click here to Skip to main content
11,631,992 members (70,111 online)
Rate this: bad
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
0 OriginalGriff 8,393
1 Sergey Alexandrovich Kryukov 8,044
2 Mika Wendelius 6,260
3 F-ES Sitecore 2,321
4 Suvendu Shekhar Giri 1,970

Advertise | Privacy | Mobile
Web04 | 2.8.150728.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2015
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