Web Connection
HTMLdropdown binding
Gravatar is a globally recognized avatar based on your email address. HTMLdropdown binding
  Greg Dohm
  All
  Jul 1, 2020 @ 07:21pm

Hi Rick,

I’m just trying to get up to speed on using the scripting approach for web pages instead of the web control framework. Mostly everything is going well. However, I’m having trouble figuring out how to bind to the application maintable using the HTMLdropdown function. I’m generating the list based on a Key,value cursor. But I can’t seem to grasp how to autobind to the main table it’s feeding. I’ve studied yet docs but chat seem to find a good example of autobinding by using the formorvalue() function. Was hoping you could help with a quick example. Thanks

Greg

Gravatar is a globally recognized avatar based on your email address. re: HTMLdropdown binding
  Rick Strahl
  Greg Dohm
  Jul 1, 2020 @ 07:41pm

You can use that as the expression value that in the binding expression:

<%= HtmlDropDown("lstCustomers",
                Request.FormOrValue("lstCustomers",poModel.Pk),  
                "TT_Cust","TRANSFORM(pk)",
                "Company + [(] + Careof + [)]",
                "","--- Select a Company") %>

Really shouldn't be any different than a textbox. This basically pulls the value from the form if it exists, otherwise uses the model value. When the control is rendered it'll compare the FormValue to the value key from the database. If that's not working - make sure you account for spaces in your captured value vs the value that the database generates. The values have to match EXACTLY. Otherwise you can adjust the Request.FormValue() expression with the appropriate padding/trimming/casing etc.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: HTMLdropdown binding
  Greg Dohm
  Rick Strahl
  Jul 2, 2020 @ 01:10pm

That worked ... thanks

© 1996-2020