[Mono-dev] [PATCH] System.Web.Compilation.TemplateControlCompiler: Data-Binding Syntax: fixed Bind functions

Igor Zalmanovich igorz at mainsoft.com
Wed Sep 27 10:10:28 EDT 2006


This is the patch to fix Bind functions (Data-Binding Syntax).

At run time, the Bind method calls the Eval method, if there is DataItem
!= null  to bind to.
If there is DataItem == null (like InsertItemTemplate in FormView) Bind
method don't raise exception and works properly to extract data from
bounded controls on postback.

See code generated by dotnet:

        public void @__DataBinding__control22(object sender,
System.EventArgs e) {
            System.Web.UI.WebControls.CheckBox
dataBindingExpressionBuilderTarget;
            System.Web.UI.WebControls.FormView Container;
            dataBindingExpressionBuilderTarget =
((System.Web.UI.WebControls.CheckBox)(sender));
            Container =
((System.Web.UI.WebControls.FormView)(dataBindingExpressionBuilderTarget
.BindingContainer));
            if ((this.Page.GetDataItem() != null)) {
                
                #line 62 "C:\www\Menu\FormView.aspx"
                dataBindingExpressionBuilderTarget.Checked =
((bool)(this.Eval("IsPublic")));
                
                #line default
                #line hidden
            }
        }


Please review.

Igor.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: TemplateControlCompiler.patch
Type: application/octet-stream
Size: 1822 bytes
Desc: TemplateControlCompiler.patch
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060927/ebca850f/attachment.obj 


More information about the Mono-devel-list mailing list