To do it soley from javascript, you'd have to load your entire
state/city database into your script, which is not a good idea.

What you'd probably like to do is implement AJAX on the page, which
will let you use javascript to query your database and update the page
without doing a postback.  Basically the javascript calls your web
app, pulls back the data and updates the appropriate contol on the
page.

http://ajax.schwarz-interactive.de/csharpsample/default.aspx

is a free library that builds the necessary wrappers for .NET to allow
you to do this.

There is a bit of a learning curve and the documentation is a bit
thin, but the scenario you are describing is a perfect fit for this.


On 7/28/05, esimplest <[EMAIL PROTECTED]> wrote:
> Thanks it works!
> 
> Also is there any easy way or sample, to dynamically populate list
> boxes using client side javascript on an aspx page without posting
> back to server. (ex. I wanted to show cities in a list box, when a
> state is selected from a drop down. Both cities and states are coming
> from the database)
> 
> We did this using server side code, but want a better way to do it.
> Any thoughts?
> 
> 
> --- In [email protected], Dean Fiala
> <[EMAIL PROTECTED]> wrote:
> > One of the quirks of ASP.NET validation controls. If there is
> nothing
> > entered, the validation won't fire.  You need to use two validators
> in
> > this case, your custom validator and a RequiredFieldValidator.
> >
> > On 7/27/05, esimplest <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > >
> > > The below code does not validate, if you just hit submit (i.e
> leaving
> > > the text box with just blank) Any idea?
> > >
> > > Thanks
> > > ****************************************************************
> > >
> > > <SCRIPT LANGUAGE="JavaScript">
> > > function validateLength(oSrc, args){
> > >    args.IsValid = (args.Value.length >= 8);
> > > }
> > > </SCRIPT>
> > >
> > > <asp:Textbox id="text1" runat="server" text="">
> > > </asp:Textbox>
> > >
> > > <asp:CustomValidator id="CustomValidator1" runat=server
> > >       ControlToValidate = "text1"
> > >       ErrorMessage = "You must enter at least 8 characters!"
> > >    ClientValidationFunction="validateLength" >
> > > </asp:CustomValidator>
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> > --
> > Dean Fiala
> > Very Practical Software, Inc
> > http://www.vpsw.com
> 
> 
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 
> 


-- 
Dean Fiala
Very Practical Software, Inc
http://www.vpsw.com


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to