asp.net - validate a template text box with database value -


i'm developing website , have textbox in gridview template field. textbox collects input "order quantity" has compared against "available quantity"(stored in database).

i use rowediting, rowupdating , rowcanceling events edit operations in gridview.

i tried implementing above requirement "textchanged" event of text box. issue is, when user edits quantity , clicks on "update" button, text box event fires first , update button event doesn't fire. so, user forced click "update" button again.

is there work around above scenario or other event used implement above requirement?

thanks, balaji g

you can use rangevalidator that...

    <asp:rangevalidator id="rangevalidator1" controltovalidate="yourtexboxid"  runat="server" minimumvalue="0" type="integer" maximumvalue='<%# getquantity(eval(totalqaunt).tostring(),eval(itemid).tostring()) %>'  errormessage="rangevalidator"></asp:rangevalidator> 

write function lyk on code behind

string getquantity(string totalquantity,string itemid) { operatrion quantity..... return quantity; } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -