This article applies to technological LookUp-form and describes how to transfer their own parameters in a LookUp-form with JavaSript API.
LookUp-form
When implementing your own LookUp form, you may need to pass several parameters and parse them when the form loads. This article will be reviewed by an example of transmission parameters when using the technological LookUp.
statement of the problem
Given the edit form with lucapa ctrlLookUp1
, lookup “looks” to the form LookUpForm.cs
generated along with the application.
Want to add to the edit form button, when clicked on the LookUp form is added to the transferred message.
solution Algorithm
- Create a button and register for her
click
method, which will be the transfer of additional parameters. - “Catch” on the LookUp form, the arrival of additional parameters and add the desired message (if necessary).
creating a button and passing parameters
- Create button:
<button id="addMessageButton">Добавить сообщение на LookUp-форму</button>
- To create a handler for the clicking:
$('#addMessageButton').click(function () {
$('#<%=ctrlLookUp1.ClientID%>').icsMasterEditorAjaxLookup('updateOptions', { formParams: 'ShowMessage=true&TheMessage=Сообщение' });
return false;
});
Note: >As in other cases work with the JS API, do not forget
return false;
to avoid PostBack. Warning: In the code of applications is not necessary to explicitly use constants
LookUp
etc., as their value may change in the future. For special technological parameters from the request, use class WebParamController . Please check the latest projects.Processing parameters on the LookUp form
On the technological LookUp-the default form method added
protected override void ApplyWolvSettings()
Add the following code:
bool showMessage = Request["ShowMessage"] != null && Request["ShowMessage"] == "true";
if (showMessage)
{
string message = Request["TheMessage"];
// Add the message.
}