In my application I need to pass a string value from the server side(.aspx.cs) to a function in the client side (.aspx) page.
Can anyone help me by providing ideas and sample code if possible?
If you mean that you need to pass the value to a javascript function, what you can do is something like this...
In the .aspx file:
<script language="javascript" type="text/javascript">
var stringValue = '<%=GetStringValue();%>';
// For example:
alert(stringValue);
</sctipt>
In the .aspx.cs file:
private string GetStringValue()
{
return "A string value";
}
This would then show a javascript messagebox saying "A string value" when the page loads
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With