AutoCompleteExtender - Key Value ID Javascript problems

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
3/25/2012 9:57:15 PM
Gravatar
Total Posts 42

AutoCompleteExtender - Key Value ID Javascript problems

Hi

I have an autocomplete Extender on a text that calls a web services to load the drop down list.

This works fine, but i need to get the actual Record ID associated with the selected text. I have changed my web service to pass back the record ID with the  text  and this works fine. 

The problem I having is with the Javascript to pull the selected record ID into a hidden field.  Most of the examples on the web have the following code which is linked into the autocompletextender via the onclientitemselected event.

<script type = "text/javascript">
    function ClientItemSelected(sender, e) {
      $get("<%=hfCustomerId.ClientID %>").value = e.get_value();
    }
</script>

 I'm using the following code to register the Above script  within MP:

 string initScript = @"function ClientItemSelected(sender, e ) {  $get(""<%=hfCustomerId.ClientID %>"").value = e.get_value();  }";

         Page.ClientScript.RegisterStartupScript(typeof(Page),
         "idDropDown", "\n<script type=\"text/javascript\" >"
         + initScript + "</script>");

the following is the code via 'view source' :

<script type="text/javascript" >function ClientItemSelected(sender, e ) {  $get("<%=hfCustomerId.ClientID %>").value = e.get_value();  }</script>

Basically I get the following error when i select a record in the autocomplete extender drop down. "Microsoft JScipt runtime error : Syntax error , unrecognized Expression : > "  in the jquery.min.js (dynamic) file

sorry i'm not a Javascript developer :(

Can anyone help  ?

Thanks

LeeB

 

 

 

3/26/2012 5:50:42 AM
Gravatar
Total Posts 42

Re: AutoCompleteExtender - Key Value ID Javascript problems

solved :

javascript should look like :

 

string initScript = @"function ClientItemSelected(sender, e ) {  $get('" + this.hfCustomerId.ClientID + "').value = e.get_value();  }";

Page.ClientScript.RegisterStartupScript(typeof(Page),"idDropDown", "\n<script type=\'text/javascript'>"   + initScript + </script>");

Record ID now be extracted.

 

Leeb

You must sign in to post in the forums. This thread is closed to new posts.