I've been racking my brains trying figure out how to build a particular type of grid. Here's what I'm trying to accomplish: I want a grid with a selection check box that when clicked populates a user-modifiable RadNumericTextBox control with a value from one of the other columns. The user must be able to modify the value after clicking and then on posting the whole grid I want to store the values that have been entered.
I tried using the GridClientSelectColumn along with some GridTemplateColumns but was unable to get it to work. I then tried using a GridTemplateColumn with an Html checkbox like so:
Yet, I could not figure out how to determine the item that was selected. Any suggestions? The idea would be that a user on checking one or more of the checkboxes would have the system default a value into the RadNumericTextbox which they could then change. After they were done, they'd post all of their changes via a button.
I tried using the GridClientSelectColumn along with some GridTemplateColumns but was unable to get it to work. I then tried using a GridTemplateColumn with an Html checkbox like so:
<telerik:RadGrid ID="Foo" runat="server" AutoGenerateColumns="False" |
GridLines="Horizontal" Width="100%" AllowMultiRowSelection="true" |
AllowAutomaticDeletes="false" |
AllowAutomaticInserts="false" AllowAutomaticUpdates="false" |
OnNeedDataSource="Foo_NeedDataSource"> |
<MasterTableView DataKeyNames="Key" CommandItemDisplay="None" |
TableLayout="Fixed" ShowHeader="true" Width="784px" EditMode="InPlace"> |
<Columns> |
<telerik:GridTemplateColumn UniqueName="Allocate" HeaderText="Pay?"> |
<HeaderStyle Width="35px" /> |
<ItemStyle Width="35px" HorizontalAlign="Center" /> |
<ItemTemplate> |
<input id="AllocateEdit" type="checkbox" onclick="" /> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridTemplateColumn DataField="AllocatedAmount" UniqueName="AllocatedAmount" |
HeaderText="Amount"> |
<HeaderStyle Width="75px" /> |
<ItemStyle Width="75px" /> |
<ItemTemplate> |
<telerik:RadNumericTextBox ID="AllocatedAmountEdit" runat="server" Type="Number" Height="15px" |
Width="65px" MinValue="0" MaxValue="2147483647" NumberFormat-DecimalDigits="0" |
DbValue='<%# DataBinder.Eval(Container.DataItem, "AllocatedAmount") %>'> |
<EnabledStyle HorizontalAlign="right" /> |
</telerik:RadNumericTextBox> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridBoundColumn DataField="Amount" HeaderText="Amount" ReadOnly="true"> |
<HeaderStyle Width="200px" /> |
<ItemStyle Width="200px" /> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="OtherStaticDataColumn" HeaderText="OtherStaticDataColumn" ReadOnly="true"> |
<HeaderStyle Width="70px" HorizontalAlign="Center" /> |
<ItemStyle Width="70px" HorizontalAlign="Right" /> |
</telerik:GridBoundColumn> |
</Columns> |
</MasterTableView> |
<ClientSettings> |
<Selecting AllowRowSelect="true" /> |
</ClientSettings> |
</telerik:RadGrid> |
Yet, I could not figure out how to determine the item that was selected. Any suggestions? The idea would be that a user on checking one or more of the checkboxes would have the system default a value into the RadNumericTextbox which they could then change. After they were done, they'd post all of their changes via a button.