Solved

return a value from javascript from vb.net web page

Posted on 2011-02-11
4
308 Views
Last Modified: 2012-05-11
I have a javascript that returns a value of true or false.  In my code behind in need to run the javascript and get a return value.  but when i try and use
if ClientScript.RegisterClientScriptBlock(Me.GetType(), "ClientScript", "checkCreditCard ('" & ddCardType.SelectedValue & "' , '" & txtCardNo.Text & "') ", True) then

I get message that this doesnt return a value.  Any ideas?

thank you
0
Comment
Question by:mgmhicks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 34874290
in your dropdown/selectbox use : ddCardType

<asp:HiddenField runat="server" ID="HiddenField1" />
<asp:DropDownList runat="server" ID="ddCardType" onchange="document.getElementByid('<%= HiddenField1.ClientID %>').value = this.value;">

Open in new window


On the server side you will be able to read the value of the asp:HiddenField
0
 

Author Comment

by:mgmhicks
ID: 34874504
leakim971 getting this error

Microsoft JScript runtime error: Object doesn't support this property or method on the 2nd line you have me.  It highlights starting at "document ...
0
 

Author Closing Comment

by:mgmhicks
ID: 34874860
I took a different approach.  I used the onchange event to call the function, then get the elements for ddcardtype and txtcardno, test the card and return value true or false back to hiddenfield.  So it was a combo of both suggestions that got me there.
thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question