View Full Version : [CLOSED] DirectMethod Parameter Value from JavaScript

Apr 08, 2013, 8:44 PM
Hi - I'm new to Ext.Net, so maybe I'm missing something, but here is the goal:
Value="FileInfo()" : Calls JavaScript function - FileInfo() should get return value from JavaScript function FileInfo() , and pass that to the DirectEvent Method as the value of the "sFilePath" param. Should pass this into the URLShareFile C# method in code behind. Is this possible?

<ext:Button ID="btnShare" runat="server"
Text="Select File, then click here toget Share/Embed Code: (URL Link):">
<Click OnEvent="URLShareFile">
* <ExtraParams> ** * * *
<ext:Parameter Name="sFilePath" Value="FileInfo()" />
<EventMask ShowMask="true" />

Apr 08, 2013, 10:48 PM

By default the .Value will be sent as a text/string value, which means in your sample the value "FileInfo()" will be sent to the DirectEvent handler on the server. The JavaScript function is not actually called under this mode.

You can work around this issue by setting Mode="Raw" on the <ext:Parameter>.

The following sample demonstrates the whole scenario.


<%@ Page Language="C#" %>

<script runat="server">
protected void Button1_Click(object sender, DirectEventArgs e)
X.Msg.Notify("Random", e.ExtraParams["random"]).Show();

<!DOCTYPE html>

<head runat="server">
<title>Ext.NET Example</title>

var getRandom = function () {
return Math.floor(Math.random() * 10);
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:Button runat="server" Text="Submit">
<Click OnEvent="Button1_Click">
<ext:Parameter Name="random" Value="getRandom()" Mode="Raw" />

Hope this helps.