How To pass the client response from a jscript prompt to vb.net

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using VB.Net 2003 to build a web page. I need to prompt the client for a
name in order to save a list. I used the following code to

btnSaveList.Attributes.Add("onclick", "var listname = prompt('You are about
to save the following list. \n\n', '" & cboMailLists.SelectedItem.Text &
"');if (listname) {" + Me.sListName + " = listname;}")

When i select the button I get an error and the buttons onclick="var
listname = prompt('You are about to save the following list. \n\n', 'Cheryls
Chain List');if (listname) { = listname;}"

is missing my vb.net variable Me.sListName.

How can I pass the value from the jscript prompt to my vb.net variable?

Any help would be appreciated.

Thanks
GRB
 
GRB.

If I see it right, are you mixing up two things, what you set in the
attribute is a clientside script that knows nothing (except data) from the
serverside.

You have to write this completly in javascript. Where your control has of
couse an clientscript equivalent what you can see in the HTML part.

(I often look at the sourcecode that is created in the browswer).

I hope this helps,

Cor
 
Cor,

Thanks for the response.
2 things. I have to use vb.net 2003 and the page uses vb.net 2003 web form
controls.
I can send a value from a web form control to the promt.
I needed to use an HTML control to recieve the returned value, but when I
try to pass the result to a vb.net string variable, I get the following error.

Object reference not set to an instance of an object.

I see the value in the input textbox but cannot pass it to the vb.net
variable!!

I got all this to work!!

I cannot passing the value of this textbox to a variable the with vb.net
code page.

Here is the code.

on the aspx page in the header

function GetListName(strName)
{
var defaultstr = strName;
Form1.txtName.value = prompt('You are about to save the following Message
List.', defaultstr);
}

and on the aspx.vb page

dim sListName as String = txtName.Value

GRB
 
GRB,
I can send a value from a web form control to the promt.
I needed to use an HTML control to recieve the returned value, but when I
try to pass the result to a vb.net string variable, I get the following
error.
I have done somewhere the same trick, however with a serverside textbox and
cannot find it anymore. However, that is the one I know I can easily set the
data in at both sides

Cor
 
Cor,

Is there a way to use the java prompt that is compatible with VS.Net 2003?

Or is there another way to prompt the user for input when saving data from
the page in VS.Net 2003?

Gary
 
GRB.
Or is there another way to prompt the user for input when saving data from
the page in VS.Net 2003?
Not with a prompt, however when you put two panels on your page.
Set on one your normal page
Set on the other one just a textbox a label and a button, than you have
almost the same of course.

And make them visible when you need them.

I hope this helps,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top