Introduction


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:

  1. One form (server side form object ) per page.
  2. Full post back process.
  3. Can't have multiple server side forms in a single page.
  4. Sub-section  of the page can't be processed independently unless use the Ajax and web-service. 
  5. Can't do multiple pages post back process.


The Ajax based Multi Forms ASP.NET Framework (Amfan) developed try to solve above problems of ASP.NET web form.

  • Can have Multiple sub-forms per page.
  • Each sub-form  developed as separate aspx page.
  • Each sub-form's post back process is done on the separate  aspx page.
  • Modulated the page into multiple small forms.

Dependency :

  1.      ASP.NET Framework
  2.     JQuery

 

How To Do

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 

public partial class newform : FormPage
{
}
3. Event method for this fired event can be created for this trigger.
 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.";
        }
    }
Accessing  main form's controls  inside the sub-forms
1. Specify the   all dependent controls' id separated by comma.

2.Drive the sub-form page from the FormPage class 
public partial class newform : FormPage { }
3. Getting the dependent value
Label1.Text = GetDependentControlValue("Label2");
4. Setting the Dependent value
UpdateDependentControlValue("Label3",DropDownList1.SelectedValue);

Last edited Sep 12, 2012 at 1:50 AM by chandru0507, version 29