May 24, 2016, 10:43 AM
[CLOSED] Hidden field missing in Form
Hello
Is there a way to send a value of hidden field (TextField) to the server using HttpContext.Current.Request.Form?
Please examine following code, in the send_form() procedure, Current.Request.Form doesn't contain field1.
I migrated my code from ext.net 1.7 to 3.2.1 and in 1.x there wasn't such problem.
test3.aspx:
Is there a way to send a value of hidden field (TextField) to the server using HttpContext.Current.Request.Form?
Please examine following code, in the send_form() procedure, Current.Request.Form doesn't contain field1.
I migrated my code from ext.net 1.7 to 3.2.1 and in 1.x there wasn't such problem.
test3.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test3.aspx.cs" Inherits="pages_test3" %>
<!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 runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
test3.aspx.cs:using System;
using System.Collections.Generic;
using System.Web;
using Ext.Net;
using System.Diagnostics;
public partial class pages_test3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ResourceManager res_man = new ResourceManager();
res_man.ID = "res_man";
res_man.IDMode = IDMode.Explicit;
res_man.ViewStateMode = System.Web.UI.ViewStateMode.Disabled;
res_man.DirectMethodNamespace = "net";
form1.Controls.Add(res_man);
Panel panel1 = new Panel();
panel1.ID = "panel1";
panel1.LayoutConfig.Add(new TableLayoutConfig() { Columns = 3 });
panel1.Width = 300;
panel1.Height = 200;
form1.Controls.Add(panel1);
TextField field1 = new TextField();
field1.ID = "field1";
field1.Value = "Val1";
field1.Width = 100;
field1.Hidden = true;
panel1.Items.Add(field1);
Button button1 = new Button();
button1.Text = "Test";
button1.Listeners.Click.Handler = "net.send_form();";
panel1.Buttons.Add(button1);
}
[DirectMethod]
public void send_form()
{
string val;
val = Convert.ToString(HttpContext.Current.Request.Form["field1"]);
Debug.Print(val); //always null when field1 is hidden
}
}
Last edited by pk.net; May 24, 2016 at 10:56 AM.