The ASP.NET WebForm is a great framework and every one loves it becuse easy to develop applications using it. But, every one hates it too since it has some limitations:
The Ajax based Multi Forms ASP.NET Framework (Amfan) developed try to solve above problems of ASP.NET web form.
Dependency :
Simple 5 steps process:
1. Add MultiForms.dll to your project reference/bin
2. Add the form tag in to the top of the main page.
<%@ Register TagPrefix="MultiForms" Namespace="MultiForms" Assembly="MultiForms" %>
3. Add the link for jQuery in the header.
<head runat="server"> <title></title> <script src="http://code.jquery.com/jquery-latest.js"></script> </head>
4. Add the sub-form tag into the main page.
<MultiForms:FormPanel ID="FormPanel1" FormName="newform.aspx" LoadForm="true" DependentControls="Label2,Label3" TriggerControls="Button4" runat="server" />
FormName | Name and path of the sub-form. |
LoadForm | Whether load the this sub-form when main form is processing. Default value is False. This is helpful not to load all the sub forms with main-form. |
DependentControls | If the sub-form want to communicate with controls outside the sub-form(get & set), specify the all the dependent controls' id with comma separated. |
TriggerControls | Id of the trigger control to invoke this sub-form. |
5. Create separate aspx page object for the sub-form defined in step 4.
Invoke sub form by outside the control.
1. Specify the id of the control , which triggers this sub-form , in the formpanel tag.
2. Drive the sub-form page from the FormPage class
3. Event method for this fired event can be created for this trigger.public partial class newform : FormPage { }
protected void Page_Load(object sender, EventArgs e) { this.OnMultiformTrigger += new MultiFormTriggerEventHandler(MultiForm_Triggered); } protected void MultiForm_Triggered(object sender, MultiFormEventArg e) { if (e.TriggerID == "Button4") { Label1.Text = ", button4 is clicked."; } }
public partial class newform : FormPage
{
}
3. Getting the dependent value
Label1.Text = GetDependentControlValue("Label2");4. Setting the Dependent value
UpdateDependentControlValue("Label3",DropDownList1.SelectedValue);