I have a popupcontrol declared in my razor cshtml file as follow:
#Html.DevExpress().PopupControl(settings =>
{
settings.Name = "popSendBackReview";
settings.HeaderText = "Send Review Back to Scheduler";
settings.AllowResize = false;
settings.ShowHeader = true;
settings.ShowOnPageLoad = false;
settings.AllowDragging = true;
settings.CloseAction = CloseAction.CloseButton;
settings.CloseOnEscape = false;
settings.Modal = true;
settings.PopupElementID = "popSendBackReview";
settings.AutoUpdatePosition = true;
settings.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter;
settings.PopupVerticalAlign = PopupVerticalAlign.WindowCenter;
settings.Height = 280;
settings.Width = 450;
settings.SetContent(() =>
{
Html.RenderPartial("_SendBackReviewPanel");
});
}).GetHtml()
The partial view contains a memo box and button that calls an action:
#Html.DevExpress().Memo(settings =>
{
settings.Width = 300;
settings.Height = 150;
settings.Style.Add("margin-bottom", "10px");
settings.Name = "txtReviewComment";
settings.Properties.ValidationSettings.RequiredField.IsRequired = true;
settings.Properties.ValidationSettings.RequiredField.ErrorText = "A Review Comment is Required.";
settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.Text;
settings.Properties.ValidationSettings.ErrorTextPosition = ErrorTextPosition.Bottom;
settings.Properties.ValidationSettings.Display = Display.Dynamic;
settings.Properties.ValidationSettings.ValidationGroup = "Review";
}).GetHtml()
#Html.DevExpress().Button(settings =>
{
settings.Name = "btnSaveReview";
settings.Text = "Send Back for Scheduler Review";
settings.UseSubmitBehavior = false;
settings.ValidationGroup = "Review";
settings.RouteValues = new { Controller = "Matter", Action = "ResolveReview", Pass = false, Comment = Model.CommentText };
}).GetHtml()
#Html.DevExpress().Button(settings =>
{
settings.Name = "btnCancelReview";
settings.Text = "Cancel";
settings.UseSubmitBehavior = false;
settings.ClientSideEvents.Click = "function(s,e) { popSendBackReview.Hide(); }";
}).GetHtml()
I am trying to get the text that is typed into this box on the server side (in the action on my controller). In other places in my application I have been able to use the following code to get values of controls:
public ActionResult ResolveReview(bool Pass)
{ ...
EditorExtension.GetValue<string>("txtReviewComment")
...}
However this returns null in this scenario. What is the correct way to get this value from a control in a partial view rendered in a popupcontrol?
In general, it is necessary to wrap editors within a form container in order to pass the entire form's content on submit. Then, it is possible to retrive the required editor's value using the standard Model Binding mechanism. When using DevExpress MVC Editors, make sure that the DevExpressEditorsBinder is registered:
#using(Html.BeginForm("ResolveReview")) {
#Html.DevExpress().Memo(settings => {
settings.Name = "txtReviewComment";
}).GetHtml()
#Html.DevExpress().Button(settings => {
settings.Name = "btnSaveReview";
settings.UseSubmitBehavior = true;
}).GetHtml()
}
public ActionResult ResolveReview(bool Pass) {
EditorExtension.GetValue<string>("txtReviewComment")
}
or
public ActionResult ResolveReview(string txtReviewComment) { ... }
Check the MVC Data Editors - Model Binding and Editing learning resource.
I found the answer on my own, my button was causing a GET method to fire instead of POST. By setting "UseSubmitBehavior" to true on my save button, it started firing the POST function and allowing the
EditorExtension.GetValue<string>("txtReviewComment")
line to get a value.
Related
I need to export all records in Applications Tab Menu of Bill and Adjustments screen as I did in UI like this screenshot below.
I already create codes to provide it using this code below.
try
{
context.CookieContainer = new System.Net.CookieContainer();
context.Timeout = 10000000;
context.Url = url;
LoginResult login = context.Login(username, password);
AP301000Content konten = context.AP301000GetSchema();
//context.AP301000Clear();
konten.DocumentSummary.Type.Commit = false;
konten.DocumentSummary.Type.LinkedCommand = null;
var command = new Command[]
{
new Value { Value = "Bill", LinkedCommand = Konten.DocumentSummary.Type },
new Value { Value = "00123", LinkedCommand = konten.DocumentSummary.ReferenceNbr },
konten.DocumentSummary.Vendor,
konten.Applications.ReferenceNbrDisplayRefNbr,
konten.Applications.DocTypeDisplayDocType
};
var result = context.AP301000Export(command, null, 0, false, true);
}
catch (Exception x)
{
MessageBox.Show(x.Message);
}
finally
{
sCon.getLogout(context);
}
After i debug this code I got records only for VendorCD but Reference Nbr and Doc Type didn't exported. Please refer to this screenshot below.
please how to solve this issue.
Thanks
You should use "every" fields:
var command = new Command[]
{
konten.DocumentSummary.ServiceCommands.EveryDocType,
konten.DocumentSummary.ServiceCommands.EveryRefNbr,
konten.DocumentSummary.Vendor,
konten.Applications.ReferenceNbrDisplayRefNbr,
konten.Applications.DocTypeDisplayDocType
};
aspx.cs
string aa= dt.Rows[0]["fruit"].ToString();
if (aa== "apple")
{
RadioApple.Checked = true;
RadioLemon.Checked = false;
}
else
{
RadioLemon.Checked = true;
RadioApple.Checked = false;
}
I would like to make it in short way like this:
string aa= dt.Rows[0]["fruit"].ToString();
RadioButton rb= RadioGroupFruit.Items.Find(aa);
rb.Checked = true;
Any ideas?
using ext.net in asp.net
For RadioButtonGroups & CheckBoxGroups try getting the value of the BoxLabel.
// pseudo code
string[] selectedFruit = this.CheckboxGroupFruity.items.where(q => q.Checked).select(q => q.BoxLabel).ToArray();
I'm using ScrapySharp to post a form to search cases on the Maryland Case Search web app.
Using Fiddler, I found the form name and form fields; however, every time I post, it always come back the initial search page, not the results.
Not sure what I'm missing, see code below.
Any assistance is truly appreciated.
string url = #"http://casesearch.courts.state.md.us/casesearch/processDisclaimer.jis?disclaimer=Y";
ScrapingBrowser Browser = new ScrapingBrowser();
Browser.AllowAutoRedirect = true;
Browser.AllowMetaRedirect = true;
WebPage PageResult = Browser.NavigateToPage(new Uri(url));
PageWebForm form = PageResult.FindForm("inquiryForm");
form["firstName"] = "";
form["middleName"] = "";
form["partyType"] = "";
form["filingStart"] = "";
form["filingEnd"] = "";
form["action"] = "Search";
form["company"] = "N";
form["countyName"] = "MONTGOMERY COUNTY";
form["courtSystem"] = "B";
form["filingDate"] = "4/4/2016";
form["lastName"] = "A";
form["site"] = "CIVIL";
form.Method = HttpVerb.Post;
WebPage results = form.Submit();
Console.WriteLine(results.ToString());
You need to make async calls.
Ex:
WebPage mainPage = await browser.NavigateToPageAsync(new Uri(url), HttpVerb.Get,"", "text/html; charset=UTF-8");
PageWebForm form = mainPage.FindFormById("some-form_id");
...
WebPage web = await Task.Run(() => form.Submit()); // submit is not async, so let's force it
Try this:
form.FormFields.Where(f => f.Name == "countyName").FirstOrDefault().Value = "MONTGOMERY COUNTY";
I am trying to create a tab via the DocuSign API with the following requirements:
Optional
Text
Anchored
Shared
Has a Default Value
However, when i set the value of the tab before composing and sending the envelope, the tab will not be editable to any of the Recipients. See code below:
private static Tab buildOptionalInputTab(String recId, String docId, String defaultValue)
{
Tab tab = new Tab();
tab.RecipientID = recId;
tab.AnchorTabItem = new AnchorTab { AnchorTabString = "Tracking #:" };
tab.AnchorTabItem.XOffset = 135;
tab.AnchorTabItem.YOffset = -8;
tab.DocumentID = docId;
tab.Type = TabTypeCode.Custom;
tab.CustomTabRequiredSpecified = true;
tab.CustomTabRequired = false;
tab.CustomTabType = CustomTabType.Text;
tab.Name = "Tracking #";
tab.SharedTabSpecified = true;
tab.SharedTab = true;
tab.Value = defaultValue; //REMOVE THIS LINE AND IT WORKS
return tab;
}
Add tab.Locked = false; to your SOAP request and you should be able to set the default value while also making it editable.
I'm trying to run a validation on the textboxes of an asp page using javascript, but my second javascript function doesn't work as expected. I run the validation on the onblur event of each textbox, so I do:
<asp:TextBox ID="txtRegApellidoPat" runat="server" onblur="validaFormato(this);"> </asp:TextBox></td><td><asp:Label ID="valtxtRegApellidoPat" class="validaCad" runat="server">Únicamente texto</asp:Label>
Then on the textboxes that require integrers I do:
<asp:TextBox ID="txtRegEdad" runat="server" onblur="validaFormatoNum(this);"></asp:TextBox></td><td><asp:Label ID="Label1" class="validaNum" runat="server">* Solo números</asp:Label>
However this last function (validaNum) isn't working, and seems to return false always on the regularexpression.test method that I invoke.
My javascript code is like so:
<script type="text/javascript">
var formato = document.getElementById('formReg');
var textos = new Array("txtRegNombre", "txtRegApellidoPat", "txtRegApellidoMat", "txtRegEdo");
var numeros = new Array("txtRegEdad", "txtRegTel", "txtRegCP");
var pattern = /([A-Z]|[ÁÉÍÓÚáéíóúÄËÏÖÜäëïöü])+[^\d+]/g;
var pattern2 = /^\d$/g;
var invalidos1=document.getElementsByClassName("validaCad");
var invalidos2=document.getElementsByClassName("validaNum");
function validaFormato(obj) {
var valido = false;
if (!pattern.test(obj.value)&&!obj.value=="") {
invalidos1[0].style.display = "inline";
invalidos1[1].style.display = "inline";
invalidos1[2].style.display = "inline";
invalidos1[3].style.display = "inline";
return valido;
}
else {
invalidos1[0].style.display = "none";
invalidos1[1].style.display = "none";
invalidos1[2].style.display = "none";
invalidos1[3].style.display = "none";
valido = true;
}
return valido;
}
function validaFormatoNum(obj) {
var valido = false;
if (!pattern2.test(obj.value) && !obj.value == "") {
invalidos2[0].style.display = "inline";
invalidos2[1].style.display = "inline";
invalidos2[2].style.display = "inline";
return valido;
}
else {
invalidos2[0].style.display = "none";
invalidos2[1].style.display = "none";
invalidos2[2].style.display = "none";
valido = true;
}
return valido;
}
</script>
I'd really appreciate a hint on this as I can't realize what's the problem. The thing is that the number fields behave erratically, when I write a number on them the first time, the associated label doesn't show, which is correct behavior, but then when I tab through the form and tab out of the number field again, the label shows, as if the value was not a number, then on the following tab, the label doesn't show, then it shows, then it doesn't, etcetera.
I'm really at a loss when it comes to regular expressions so I don't know if the problem is with my second RegExp, but it's simply asking to have a number at the beginning and end of the string, isn't it?
I guess you have to change
var pattern = /([A-Z]|[ÁÉÍÓÚáéíóúÄËÏÖÜäëïöü])+[^\d+]/g;
to (move the + out of the character class):
var pattern = /([A-Z]|[ÁÉÍÓÚáéíóúÄËÏÖÜäëïöü])+[^\d]+/g;
that could be rewritten:
var pattern = /[A-ZÁÉÍÓÚáéíóúÄËÏÖÜäëïöü]+\D+/g;