Hi
I have a problem, on my page (*.aspx) i have a string written on klients
computer in javascript. How can i pass this string to the codebehind
*.cs file? From there i want to store it to a database...
//Micke
Leon Mayne - 19 Mar 2006 21:09 GMT
> I have a problem, on my page (*.aspx) i have a string written on
> klients computer in javascript. How can i pass this string to the
> codebehind *.cs file? From there i want to store it to a database...
You could create a blank hidden form field and get the javascript to
populate its value before postback, e.g:
<form id="form1" runat="server">
<asp:HiddenField ID="HiddenField1" runat="server" />
<input type="submit" name="submit" value="GO" />
<br />
<asp:Literal ID="litResult" runat="server"></asp:Literal></form>
<script language="javascript" type="text/javascript">
<!--
document.form1.HiddenField1.value='Your value';
//-->
</script>
In the code behind file:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Page.IsPostBack = True Then
litResult.Text = HiddenField1.Value
End If
End Sub
Michael Bohman - 20 Mar 2006 21:12 GMT
Leon Mayne skrev:
>> I have a problem, on my page (*.aspx) i have a string written on
>> klients computer in javascript. How can i pass this string to the
[quoted text clipped - 22 lines]
> End If
> End Sub
thank's i'll have a look
Cor Ligthert [MVP] - 20 Mar 2006 08:17 GMT
Michael,
You can use one of the register script methods, there are more in the Page
class. Have a look at this.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fsystemwebuipageclassregisterclientscriptblocktopic.asp
I hope this helps,
Cor
> Hi
>
[quoted text clipped - 3 lines]
>
> //Micke
Michael Bohman - 20 Mar 2006 21:11 GMT
Cor Ligthert [MVP] skrev:
> Michael,
>
[quoted text clipped - 14 lines]
>>
>> //Micke
Thank's i'll have a look