asp:UpdatePanel work only when other inputs are valid

Uphobibh

New Member
I have this \[code\]UpdatePanel\[/code\]:\[code\] <asp:ScriptManager ID="CheckManager" runat="server" /> <asp:UpdatePanel ID="checkUsername" runat="server" UpdateMode="Conditional" > <ContentTemplate> <asp:Label ID="canUse" runat="server" Text=""/> <asp:Button ID="check" runat="server" Text="Usable?" onclick="check_Click" /> <asp:TextBox ID="username" runat="server" ></asp:TextBox> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger controlid="check" eventname="Click" /> </Triggers> </asp:UpdatePanel>\[/code\]update code:\[code\] protected void check_Click(object sender, EventArgs e) { using (HotelEntities h = new HotelEntities()) { UserHandle u = new UserHandle(); if (u.FindUserByUsername(h, username.Text.ToString()).Any()) { canUse.ForeColor = Color.Magenta; canUse.Text = "You cannot use this username"; username.Text = ""; } else { canUse.ForeColor = Color.Green; canUse.Text = "you can use this username"; } } }\[/code\]but works only when other inputs in form (that have validations e.g. \[code\]RequiredFieldValidator\[/code\]) are valid .How can I fix this?
 
Back
Top