This problem has driven me crazy, and I hope anybody from the staff can help me about.
I was building a RadGrid with EditMode="InPlace", I decided to not auto generate columns. The grids datasource will be a list of an object with two properties "Quantity" and "MaxQuantity". The user can configure Quantity, but it should not get higher than MaxQuantity obviously. This became my grid:
For test purposes there is a static list of an object with ID-, Quantity- and MaxQuantity-Property that will be bound in the NeedDataSource event, so not really any logic in the code behind.
As you can see I use a TemplateColumn in the markup and eval the MaxQuantity in the MaxValue field. This works! I've set row one in edit mode programmically and I could not increase the RadNumericTextBox value across the MaxQuantity value, as desired.
Now I decided I want to use EditMode="Batch" with EditType="Cell", so I modified my RadGrid a bit:
Now the problem appears: When I click on a cell and the RadNumericTextBox appears its MaxValue will be set to 70368744177664 internally, the constructed value. Hence, it will not take care when I cross the MaxQuantity value.
I was experimenting a bit, and it turns out, when I change to cell batch mode, it will only assign static values to my RadNumericTextBox. It will not run any binding expression. Instead, no matter I set the Text property of the RadNumericTextBox or not, when I click the cell it will take the Text from the Label in the ItemTemplate node and pass it to the Text property of the RadNumericTextBox in the EditItemTemplate.
How can I get rid of that, as I need to limit the Quantity amount based on the MaxQuantity amount on the specified object.
Thanks in advice!
I was building a RadGrid with EditMode="InPlace", I decided to not auto generate columns. The grids datasource will be a list of an object with two properties "Quantity" and "MaxQuantity". The user can configure Quantity, but it should not get higher than MaxQuantity obviously. This became my grid:
<telerik:RadGrid ID="trgComponents" runat="server" AllowPaging="false" Culture="de-DE" CssClass="RadGrid Components" AllowSorting="false" AutoGenerateColumns="false" ShowStatusBar="false" PageSize="999999" OnNeedDataSource="trgComponents_NeedDataSource"> <MasterTableView DataKeyNames="ID" CommandItemDisplay="Bottom" EditMode="InPlace"> <Columns> <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditColumn" EditText="Bearbeiten"> <HeaderStyle Width="20px" /> </telerik:GridEditCommandColumn> <telerik:GridTemplateColumn UniqueName="Quantity" HeaderText="Anzahl" ItemStyle-CssClass="editableCell" ItemStyle-HorizontalAlign="Right"> <HeaderStyle Width="80px" /> <ItemTemplate> <asp:Label ID="lQuantity" runat="server" Text='<%# Eval("Quantity") %>' /> </ItemTemplate> <EditItemTemplate> <telerik:RadNumericTextBox ID="trntbQuantity" runat="server" Type="Number" MinValue="0" MaxValue='<%# Convert.ToDouble(Eval("MaxQuantity")) %>' Text='<%# Bind("Quantity") %>' Width="77" ShowSpinButtons="true" NumberFormat-DecimalDigits="0" EnabledStyle-HorizontalAlign="Right" /> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridNumericColumn UniqueName="MaxQuantity" HeaderText="Max. Anzahl" DataField="MaxQuantity" DataType="System.Int32" ItemStyle-HorizontalAlign="Right" ReadOnly="true"> <HeaderStyle Width="80px" /> </telerik:GridNumericColumn> </Columns> </MasterTableView></telerik:RadGrid>For test purposes there is a static list of an object with ID-, Quantity- and MaxQuantity-Property that will be bound in the NeedDataSource event, so not really any logic in the code behind.
As you can see I use a TemplateColumn in the markup and eval the MaxQuantity in the MaxValue field. This works! I've set row one in edit mode programmically and I could not increase the RadNumericTextBox value across the MaxQuantity value, as desired.
Now I decided I want to use EditMode="Batch" with EditType="Cell", so I modified my RadGrid a bit:
<telerik:RadGrid ID="trgComponents" runat="server" AllowPaging="false" Culture="de-DE" CssClass="RadGrid Components" AllowSorting="false" AutoGenerateColumns="false" ShowStatusBar="false" PageSize="999999" OnNeedDataSource="trgComponents_NeedDataSource" OnPreRender="trgComponents_PreRender"> <MasterTableView DataKeyNames="ID" CommandItemDisplay="Bottom" EditMode="Batch"> <BatchEditingSettings EditType="Cell" OpenEditingEvent="Click" /> <Columns> <telerik:GridTemplateColumn UniqueName="Quantity" HeaderText="Anzahl" ItemStyle-CssClass="editableCell" ItemStyle-HorizontalAlign="Right"> <HeaderStyle Width="80px" /> <ItemTemplate> <asp:Label ID="lQuantity" runat="server" Text='<%# Eval("Quantity") %>' /> </ItemTemplate> <EditItemTemplate> <telerik:RadNumericTextBox ID="trntbQuantity" runat="server" Type="Number" MinValue="0" MaxValue='<%# Convert.ToDouble(Eval("MaxQuantity")) %>' Text='<%# Bind("Quantity") %>' Width="77" ShowSpinButtons="true" NumberFormat-DecimalDigits="0" EnabledStyle-HorizontalAlign="Right" /> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridNumericColumn UniqueName="MaxQuantity" HeaderText="Max. Anzahl" DataField="MaxQuantity" DataType="System.Int32" ItemStyle-HorizontalAlign="Right" ReadOnly="true"> <HeaderStyle Width="80px" /> </telerik:GridNumericColumn> </Columns> </MasterTableView></telerik:RadGrid>Now the problem appears: When I click on a cell and the RadNumericTextBox appears its MaxValue will be set to 70368744177664 internally, the constructed value. Hence, it will not take care when I cross the MaxQuantity value.
I was experimenting a bit, and it turns out, when I change to cell batch mode, it will only assign static values to my RadNumericTextBox. It will not run any binding expression. Instead, no matter I set the Text property of the RadNumericTextBox or not, when I click the cell it will take the Text from the Label in the ItemTemplate node and pass it to the Text property of the RadNumericTextBox in the EditItemTemplate.
How can I get rid of that, as I need to limit the Quantity amount based on the MaxQuantity amount on the specified object.
Thanks in advice!
