how to get value from client side script Prompt window to a session var in .net

hi guyz,

i hav a problem with getting a value from a client-side inputbox to a session var in .net.
is this possible?
however, when i click submit button this is the code that's triggered.
dim sb as New System.Text.StringBuilder
sb.append("<script language=" & """" & "vbscript" & """" & ">")
sb.append(vbcrlf)

sb.append(vbcrlf)
sb.append("do while xLate =" & """" & """")
sb.append(vbcrlf)
'//prompt window, value passed to xLate var
sb.append("xlate=inputBox(" & """" & "Please Enter Reason for Being Late" & """" & ")")
sb.append(vbcrlf)
sb.append("loop")
sb.append(vbcrlf)
'// this is the part that i dynamically create an inputbox type=hidden ang get
'// the value from Prompt dialog box.
sb.append("document.write(" & """" & "<input type=hidden name=leyt id=leyt value='" & """" & "& xLate &" & """" & "'>" & """" & ")")
'// is there a way i can also dynamically write a session var that will hold the value of xLate var?????

sb.append(vbcrlf)

dim scriptString as string

scriptString += "<"
scriptString += "/"
scriptString += "script>"

sb.append(scriptString)
sb.append(vbcrlf)

RegisterClientScriptBlock("anything", sb.ToString())
thanx for the help!!!

0
carlod
7/23/2004 10:43:49 AM
asp.net.getting-started 91979 articles. 2 followers. Follow

3 Replies
531 Views

Similar Articles

[PageSpeed] 54


Once the prompt has a value, resubmit the form and use the Request.Form property to get the value of "leyt".

Steven Bey

Recursion: see Recursion
0
stevenbey
7/23/2004 11:18:54 AM
ok sorry.... this script was Fired upon form submission, it dynamically writes this.

so instead of putting the value in a textbox, i would like to capture it via session var.
document.form1.TextBox.value = inputbox("kdjfdf") '// doesn't work.. :( when written dynamically.
thanx
0
carlod
7/26/2004 6:21:54 AM

I've just thrown a test page together and it works (see below), so you can assign a value to a textbox and pass it back to the server. (Actually this is what ASP.NET does to pass back the EventTarget and EventArgument values)
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" %>

<script runat="server">
protected void Button_Click(Object Src, EventArgs E){
lbl1.Text = tb1.Text;
}
</script>
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script language="JavaScript">
function test () { document.all [ "<%= tb1.UniqueID %>" ].value = prompt("where are you going today?",""); }
</script>
</head>
<body>
<form runat="server" onsubmit="test();">
<asp:textbox ID="tb1" runat="server" />
<asp:button runat="server" Text="Click Me!" OnClick="Button_Click" />
<asp:label ID="lbl1" runat="server" />
</form>
</body>
</html>
So all you need to do now is assign the value to a Session variable, rather than the Label.

Steven Bey

Recursion: see Recursion
0
stevenbey
7/26/2004 7:16:46 PM
Reply:

Similar Artilces:

Getting Value from Client-side InputBox to .net variable
hi, im doing a login page for our timekeeping. Since there's no msgbox available on asp.net, im doing it dynamically via javascript. How do i Get the value frm a dynamically written javascript (such as inputbox) to a .net variable? here's the logic of my program, user logs in hits the button and sub-routine Login will be fired, if user is late -- call Check_Late Sub, this is whre the client-side script was built -- then after that i wanted to be able to get the value from an inputbox. '// if button login clicked Sub Login(Sender As Object, E As EventArgs) .......

how to get value from client-side Prompt
hi guyz, i'm doing a login page in .net, now after submission -- and if ur late -- a client-side prompt box will appear to enter your reason for being late , now.. how do i get the value back to .net??? could you please give me an example? thanx and GodBless. :) You could save the response from the client-side prompt into a hidden field and then extract the value on the server. This example, prompts for a reason, stores the response into a hidden field named "reason" and then extracts the reason from the Request.Form collection and sets it in the page: <%@ Page Lan...

getting value from client-side prompt box
hi, i'm having problem getting value from prompt box. Here's the logic of my Login application. User logs in, when button clicked -- subroutine Login will be fired. if user is Late in his working hour, sub routine check_late will be fired and it creates a client-side script dynamically. a prompt box will not be closed by any keys except when u fill-out the reason for being late. then after that, how do i get the value of it back to my .net application? Help anyone? i'm quite desperate on this. thanx guys :) '// if button login clicked Sub Login(Sender As ...

Assigning Session from .NET to client-side script
hi, I am wondering how to assign a Session as a variable to client-side script (javascript)?? I am trying to pass a page URL (eg. current.aspx) to a javascript like (Close) when this button is clicked. My code as follow, but it done'st really work ... ================================================== <%@ Page Language="VB" %> <script runat="server"> sub page_load(ByVal sender As System.Object, ByVal e As System.EventArgs) session("link") = "current.aspx" end sub </script> <html&...

Getting ListBox values added with client-side script
Greetings, I have two listboxes that I am using client-side script to move items between (on a user control placed on child form using a master page, if any of this matters). When the form posts back, the lists always have whatever items they started out with, regardless of changes made client-side. I've tried turning ViewState off for these controls. Same result. I've tried getting the values directly via: string[] s1 = Request.Form.GetValues(MyList.ClientID);andstring[] s1 = Request.Form.GetValues(MyList.UniqueID);andstring s1 = Request.Form[MyList.ClientID];andstring s1 = Request.F...

How to make a DataListImagesShow.Items collection and get the value = sessions (VB.NET)
Hi. I have a code that put some data in a DataList, what i need now it to make a DataListImagesShow.Items collection, and there make a value = a session-parameter.But how do i do that !? i have look at http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.repeateritem(VS.80).aspx  but cant get it. How do i make a DataListImagesShow.Items collection that can take the tabel (From the db) "DogImageDate" and make tha value = with Session("DID") and how do i call the sub, or writeout the results on my site. My DataList code is:  Public Sub OpenDB() Dim Ob...

how to get start with .NET
the net help people installed  to my desktop 1-microsoft visual studio .NET enterprise developer 2003 2-microsoft .NET framework 1.1 what else do i need ...???  and how can i try with some simple code in VS.Net and run it to see wat happen...????? please help If you want to develope web applications, then you'll also need IIS on your PC.  That'll require XP-Professional or Windows 2000/2003, but XP-Home edition won't allow IIS installation. As for how to get started, you can search the web for some tutorials or buy a good book on VS.  The topic is way too vast to...

Getting Start With .net
hi i'm intersted to learn asp.net (vb or delphi) . i programming with delphi6 but i'd like to tp know something about programming in internet specially with .net . i hear about microsoft.net with delphi 7 that i can programming with delphi in .net .... is it right ? what 's our opinian about it ? and better to learn Vb.Net or continu with delphi(or delphi.net) thanks. Ali Darabian I think there is some support for Delphi in .Net. However, you will find much more support from the user community if you choose a more popular language such as VB.Net or C#. Since your al...

How to get the Client side values in server side code.
Hi all, i have a proble i need to get the client side javascript values in C# code at server side. how can i pass those values? i am using version 1.1, i kno thatwe can use callback events mechnisam in 2.0 or ajax ,apart from that how we can pass? My problem is i need to stop the execution of the code based on after reciving values from the client   any ideas please???   Million thanks RamCheersRam MCP Hello Ram, a common approach is from javascript set an hidden field, then issue a postback. On the server-side, handle the post-back. Feel free to go deeper in your que...

Developed C#.net WebService 1.1 for Client C#.net 1.1. Getting error "Server was unable to process the Request" Pls Help
Hi., I developed Microsoft C#.net Web Services2003 for the Client Application C#.net 2003. When it runs in 5 machines it gives good performance and has no errors. But if i run the same application in about 80 client machines. Getting error "Server was unable to process the request". I use Sql Server 2005 as my database. I get error even when i login at a time for about 25 users. Tried modifying machine.config too. But went unsuccessful. Live Server is 2003 using IIS 6.0 I use very expensive data handling.  Its very urgent pls help. Have to post in Live Server. Thank u., ...

How to get Windows Scripting Host Back or find another way of getting Windows Update?
I ( perhaps hastily) removed WSH from ME manually by deleting C:\WINDOWS\WSCRIPT.EXE C:\WINDOWS\SYSTEM\WSHEXT.DLL C:\WINDOWS\SYSTEM\VBSCRIPT.DLL C:\WINDOWS\SYSTEM\WSHOM.OCX C:\WINDOWS\SYSTEM\SCRRUN.DLL Now I would like to be able to run Windows Update and can't. Yes - I know it's my fault - I was too hasty! The files are no longer in the recycle bin. Suggestions please. And Is it best in future to use the Symantec program to turn WSH off and on at will? -- Chris "Chris" <nospam@[127.0.0.1]> wrote in message news:rVfUkRAffwI8Ewsa@[127.0.0.1]......

Getting hidden variable value from server side in client side
hi,        I am struck in problem. I have a hidden field in my form and i am setting some value in that.         Now i wnt to use this value from client side but i m not able to retrieve it. All i am getting there is an object.         I feel the hidden field is not able to hold that value.         <input type="hidden" id="hdnVar" runat="server" />         in code behind      ...

How to get RS (From VB6) to .NET (VB.NET)
Hi Friends,         I have requirement, there is one function in VB6 it returns a RS, I need to call that function in  VB.NET, how to get those values into .NET, if can any body can help (pass me some code snippets), that will be greate, Thank you.Madhu... -Madhu hey guys i got this one just by using fill method.-Madhu...

Getting error in Net::SFTP with get function
------=_Part_7028_3315294.1193837808284 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi All, I have the following code as part of my program; print "---=========> $file, $localFile\n"; $sftp -> get( $file, $localFile ) || warn("errrrr0rrrrr _---> $!".$sftp->status."\n");^M Even though it has downloaded the file properly, it is giving the following message: ---=========> /trading/tiscrdenhlist10310000.txt.old, /export/home/crdadm/rajeev/tiscrdenhlist103...

Web resources about - how to get value from client side script Prompt window to a session var in .net - asp.net.getting-started

Joint session of the United States Congress - Wikipedia, the free encyclopedia
Joint sessions of the United States Congress are the gatherings together of both houses of the United States Congress (the House of Representatives ...

Australia v West Indies: New year nets session to decide Peter Siddle's fate
Peter Siddle and Josh Hazlewood's hopes of playing in the Sydney Test will be more apparent on Friday but Australia coach Darren Lehmann won't ...

Is this the world’s first full virtual-reality motion/voice capture session?
Actors combine mo-cap suit, HTC Vive to become characters, see virtual teleprompters. Forget latex suits and white ping-pong balls. Motion-capture ...

PAUL RYAN WHINES: Cruz and Sessions Lying About Omnibus Funding New Wave of Muslim Migration
By Julia Hahn In a Tuesday morning interview with radio host Bill Bennett, House Speaker Rep. Paul Ryan (R-WI) implied that prominent conservative ...

Bonnie 'Prince' Billy releasing compilation of Peel Sessions, shares new version of "Rich Wife Full of ...
by Andrew Sacher Bonnie 'Prince' Billy (aka Will Oldham) is releasing Pond Scum on January 22 via Drag City. It's a collection of Peel Sessions ...

Venkaiah Naidu attacks Chidambaram, hopes GST passes in Budget session
Naidu alleged that as per the 'script', the Congress was 'dodgy' on this important issue

Saturday Sessions: Andra Day performs "Rise Up"
Andra Day had a breakout year in 2015, with the release of her first studio album and her first headline tour

Orrin Evans Searches for 'The Evolution of Oneself,' Smoke Sessions Records (REVIEW)
It's a Philly thing, man. It's also a family thing. For his 26th album, pianist Orrin Evans has formed his dream trio.

Dow Jones Industrial Average Down on Final Session of 2015
Dow Jones Industrial Average Down on Final Session of 2015

Donald Trump Causes Kerfuffle At NBC TCA Exec Session
Donald Trump continues to make news for NBC , even when he’s not on its air. Today at TCA , NBC execs got asked to defend inviting the GOP frontrunner ...

Resources last updated: 1/16/2016 3:53:03 PM