We help IT Professionals succeed at work.
Get Started

update panel not working

165 Views
Last Modified: 2014-10-08
I have the below code to ty check mysql database and show if username is ok or not to use (if in db no - if not then yes.

signup.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="signup.aspx.vb" Inherits="signup" %>
 <%@ Register Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" tagPrefix="ajax" %>
<asp:ScriptManager ID="scriptmanager1" runat="server">
</asp:ScriptManager>
<div>
<asp:UpdatePanel ID="updatepnl" runat="server">
<ContentTemplate>
<table>
<tr>
<td>
Enter UserName 
</td>
<td>:</td>
<td>
<asp:TextBox ID="txtun" runat="server" AutoPostBack="true" OnTextChanged="CheckUserNameAvailability"/>
</td>
<td>
<div id="checkun" runat="server"  Visible="false">
<asp:Image ID="shwimg" runat="server" Width="17px" Height="17px"/>
<asp:Label ID="lblmsg" runat="server"></asp:Label>
</div>
</td>
</tr>
<tr>
<td>
Enter Password 
</td>
<td>:</td>
<td>
<asp:TextBox ID="txpwd" runat="server" TextMode="Password"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Enter Confirm Password 
</td>
<td>:</td>
<td>
<asp:TextBox ID="txtconpwd" runat="server" TextMode="Password"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="3">
<asp:Button ID="txtbtn" Text="SUBMIT" runat="server" align="center" />
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>

Open in new window


signup.aspx.vb

Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Data
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports MySql.Data.MySqlClient

Partial Class signup
    Inherits System.Web.UI.Page
	Dim MysqlConn As MySqlConnection
Dim con As New mySqlConnection(ConfigurationManager.ConnectionStrings("dbconnection").ConnectionString)
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    End Sub





		
		
	Protected Sub CheckUserNameAvailability(sender As Object, e As EventArgs)
		If Not String.IsNullOrEmpty(txtun.Text) Then
			Dim con As New mySqlConnection("Data Source=localhost;Initial Catalog=runningprofiles;User ID=8888;Password=88888")
			con.Open()
			Dim cmd As New mySqlCommand("select * from members where email=@un", con)
			cmd.Parameters.AddWithValue("@un", txtun.Text)
			Dim dr As mySqlDataReader = cmd.ExecuteReader()
			If dr.HasRows Then
				checkun.Visible = True
				shwimg.ImageUrl = "Cancel.png"
				lblmsg.Text = "UserName Already Exist..!!"
			Else
				checkun.Visible = True
				shwimg.ImageUrl = "Accepted.png"
				lblmsg.Text = "Congratulation created Successfully..!!"
			End If
		Else
			checkun.Visible = False
		End If
	End Sub






    
End Class

Open in new window


but it shows nothing when entering information.... where have a gone wrong and how can i fix it??

the site itself is here: http://runningprofiles.com/signup.aspx
Comment
Watch Question
Top Expert 2011
Commented:
This problem has been solved!
Unlock 1 Answer and 14 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE