Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
830
Two-way binding Bind("xxxxx") not working while used in template item (TextBox)
posted

Hi,

Could someone help for this pls ?

 

Like in the gridView of the asp.net, I want to use the expression Text ='<%# Bind("xx") %>'  in my templateItem column (Textbox in my case), so that the value that user enters in a textbox can be read in the datasource (it s a session datatable) in code behind in an automatic way  :

Here is my item template which is defined in: <Columns>  section of my WebDataGrid declaration:

<ig:TemplateDataField Width="250px"  Key="bbbbbbbbbb">
                    <Header Text="Description"" />
                    <ItemTemplate>  
                    <asp:TextBox ID="Description" Columns="25" Text='<%# Bind("Description") %>'  
                    runat="server" TextMode="MultiLine" onkeydown="dirty()" onkeypress="event.returnValue=isMax_Length_256(event, this);"></asp:TextBox>
                    </ItemTemplate>                   
                 </ig:TemplateDataField> 

The binding in code behind is done like this:

          System.Data.DataTable dt = _provider.MainDataSource();
          this.Session.Add("CurrentDataSource", dt);

myWebDataGrid.DataSource = this.Session["CurrentDataSource"];

this.myWebDataGrid.DataBind();

 

During binding process every thing works fine, I get the value into my textbox defined above. However, when I edit the text entering a new value, I don't get the new value in my session datatable variable.

Pls notice that the process works WELLwhen I don t put an itemtemplate with a textbox i-e if I only declare a bound fata field and use the Editing. However when I have an item template: I only get one way binding instead of two-way binding.

I am not sure if my editor behavior is taken into account either ?? here it's:

<ig:EditingCore>
                <Behaviors>
                    <ig:CellEditing>
                        <ColumnSettings>
                            <ig:EditingColumnSetting ColumnKey="Description"    />
                            <ig:EditingColumnSetting ColumnKey="projection"  ReadOnly="true" />
                            <ig:EditingColumnSetting ColumnKey="pointe"  ReadOnly="true" />
                            <ig:EditingColumnSetting ColumnKey="id"  ReadOnly="true" />
                            <ig:EditingColumnSetting ColumnKey="scheduled"  ReadOnly="true" />                           
                            <ig:EditingColumnSetting ColumnKey="offsetThreshold"  ReadOnly="true" />
                            <ig:EditingColumnSetting ColumnKey="usageThreshold"  ReadOnly="true" />
                        </ColumnSettings>
                        <%--<CellEditingClientEvents EnteredEditMode="enteredEditMode" /> --%>  
                    </ig:CellEditing>
                   
                    <ig:RowDeleting Enabled="true" />
                    
                   
                   
                </Behaviors>
            </ig:EditingCore>          
           
           
            <ig:Activation>           
            </ig:Activation>
           
            <%--<ig:Selection RowSelectType="Single" Enabled="true" CellClickAction="Cell"></ig:Selection>--%>
          <%--  <ig:RowSelectors></ig:RowSelectors>--%>

        </Behaviors>
        <EditorProviders>
            <ig:TextEditorProvider  ID="PerfIndicatorContent_MultilineEditor">
            <EditorControl runat="server" ID="editorm" TextMode="MultiLine">
                    <MultiLine Overflow="Scroll" Rows="3" />
                   
                   
                   
                </EditorControl>
              </ig:TextEditorProvider>             
        </EditorProviders>

Thanks a lot for helping me with this one :)