Results 1 to 2 of 2

Thread: OnSelectedIndexChanged...

  1. #1
    Join Date
    Dec 1969

    Default OnSelectedIndexChanged...

    I am using the asp drop down list and trying to submit a form<BR><BR>&#060;asp:dropdownlist CssClass="lstbx" ID="title_id" DataValueField="title_id" DataTextField="title_name" OnSelectedIndexChanged="GetVehicleRate" AutoPostBack="true" runat="server" /&#062;<BR><BR>I have another field where input has to be put first before the dropdown submits. I have added the aspvalidator control for that txt field.<BR><BR>But the sad part it, when I am submitting the dropdown without any value in the text field it just submits without giving an error that field is empty...<BR><BR>While using the same code if I have a submit button... it gives me an error that field is empty.<BR><BR>What could be the problem and how to solve it<BR><BR>Thanc

  2. #2
    Join Date
    Dec 1969

    Default RE: OnSelectedIndexChanged...

    The thing is that the onselectedindexchanged event will fire a sub that you define using using the autopostback. Therefore it will not validate your other text field using an asp validator. The simplest solution is to write code in your defined sub that checks that text field for a value. Or else remove your onselectedindexchanged & autopostback event.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts