Click here to Skip to main content
15,904,503 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
protected void Button6_Click(object sender, EventArgs e)
   {
       ddl_title.Items.Add(TextBox1.Text.ToString());
       lblAddedSalutation.Text = "Your new title is now ready to be selected";
   }



I am adding the text to a dropdown in ASP.net page.

It is working fine but I have few text boxes below this button and I have used required field validator for those text boxes.

When the textboxes are empty the page is re-loading and ask me to enter the text boxes but I don't to do the requiredfield validator checking at this stage.
Posted

Hi, you can't disable postback, but you can use client side postback, its fast and easy to use with Asp.net ajax extension (in the tool box).

here is a link how to use it:
http://www.youtube.com/watch?v=3HdJu1U6ciQ
 
Share this answer
 
v2
just add display="dynamic" for the requiredfieldvalidator
like this
XML
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
            ControlToValidate="TextBox1"  Display="Dynamic" SetFocusOnError="true" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900