views:

150

answers:

1

I would like to share my problem with you in detail.

1) I have a textbox and a button in my page consider it as home.aspx

2) I have written the code like this:

<asp:Button id="btnSubmit" runat="server" Text="Submit" PostBackUrl="~\search.aspx"
        OnClientClick="validate();" />

3) I have to check wheteher the textbox is null. If not null i want to redirect to search.aspx as given in the postbackurl.

4) Using java script i have validated;

function validate()
   {
      if(document.getElementById('txtCity').value!='')
      { alert('please enter the city to search'); returnn false;}
   }

5) If the textbox is null. It alerts to enter the city. If not the page remains. It is not redirected to the search page.

I hope you can..

A: 

Kumar, You will need to provide much more information then this.

A blind guess at what you are asking, is that you have a button on your page that causes validation. However, also on your page you have a linkbutton that should not cause validation, but just direct to the PostBackUrl.

You can accomplish this one of two ways: 1. Add a validation group to your button and all the controls it should validate. 2. On your LinkButton, add CausesValidation="false" to your declaration.

If these blind guesses are not helpful, please provide much more information.

Clarence Klopfstein