Click here to Skip to main content
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 6,651
1 Sergey Alexandrovich Kryukov 6,400
2 CPallini 5,230
3 George Jonsson 3,574
4 Gihan Liyanage 2,542

Advertise | Privacy | Mobile
Web03 | 2.8.140921.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2014
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