Aug 05, 2013, 6:50 PM
MVC FileUploadField Issue
Hello,
If I am using FileUploadField, then I am unable to get the value of TextArea txtMessage at code behind, however, I am successfully able to set the text of txtMessage from code-behind.
If I remove all the FileUploadField from the form, then it just work fine.
Also, I would like to know why can't we read value of any control from a different FormPanel(). If we have two formpanel() then we cannot read value of first formpanel() textbox from the button.directeventaction of second formpanel().
Please help with both of the queries.
Below is the code for the first query.
If I am using FileUploadField, then I am unable to get the value of TextArea txtMessage at code behind, however, I am successfully able to set the text of txtMessage from code-behind.
If I remove all the FileUploadField from the form, then it just work fine.
Also, I would like to know why can't we read value of any control from a different FormPanel(). If we have two formpanel() then we cannot read value of first formpanel() textbox from the button.directeventaction of second formpanel().
Please help with both of the queries.
Below is the code for the first query.
X.FormPanel().ID("PanelThread").Region(Region.Center).Title("Message Thread").Icon(Icon.TableGo).Collapsible(false).AutoScroll(true).BodyPadding(5).Frame(true).LayoutConfig(new TableLayoutConfig() { Columns = 2}).Items(
X.TextArea().ID("txtMessage").Width(650).Height(150),
X.Panel().Frame(true).Items(
X.FileUploadField().ID("Fup1").Icon(Icon.PageAttach).Width(220).EmptyText("Select a file"),
X.FileUploadField().ID("Fup2").Icon(Icon.PageAttach).Width(220).EmptyText("Select a file"),
X.FileUploadField().ID("Fup3").Icon(Icon.PageAttach).Width(220).EmptyText("Select a file"),
X.FileUploadField().ID("Fup4").Icon(Icon.PageAttach).Width(220).EmptyText("Select a file"),
X.Toolbar().Width(250).Items(
X.Button().ID("btnPostMessage").Icon(Icon.TableEdit).Text("Post Message").DirectClickAction("PostMessageClicked"),
X.ToolbarSeparator(),
X.Checkbox().ID("chkPriceQuote").FieldLabel("Price Quote")
)
),
X.Label().ColSpan(2).Html("<hr>"),
X.Label().ID("lblMessageThread").ColSpan(2).Html("<hr>")
)
[DirectMethod]
public ActionResult PostMessageClicked()
{
X.Mask.Hide();
TextArea txtMessage = this.GetCmp<TextArea>("txtMessage");
string Message = txtMessage.Text;
txtMessage.Text = "Hell Lots of trouble";
Notification.Show(new NotificationConfig
{
Title = "Error",
Icon = Icon.Accept,
Html = Message,
AutoHide = false,
CloseVisible = true,
Closable = true,
Width = 500,
Height = 500
});
return this.Direct();
}