I am not sure of the suggested method on how to accomplish this. Any assistance would be greatly appreciated.
I have a grid bound to a boolean field. If the item value is 1, I want he checkbox checked and read only (GridCheckBoxColumn would work here). If the item value is 0, I want the checkbox enabled (GridCheckBoxColumn doesn't seem to work for this) and a postback when the user checks the box so I can update the database and rebind the two grids on the page.
In short, I want it so checks can never be removed, only added, and only one item checked per postback. Grid is bound with NeedDataSource event.
Any suggestions?
Here is what I have now. When it is done, I only want to have one column of checkboxes, the three below are all tests.
I have a grid bound to a boolean field. If the item value is 1, I want he checkbox checked and read only (GridCheckBoxColumn would work here). If the item value is 0, I want the checkbox enabled (GridCheckBoxColumn doesn't seem to work for this) and a postback when the user checks the box so I can update the database and rebind the two grids on the page.
In short, I want it so checks can never be removed, only added, and only one item checked per postback. Grid is bound with NeedDataSource event.
Any suggestions?
Here is what I have now. When it is done, I only want to have one column of checkboxes, the three below are all tests.
| <telerik:RadGrid runat="server" ID="RadGrid1" AutoGenerateColumns="false" |
| GridLines="None" Height="500" BorderWidth="0" AllowSorting="true" Style="outline: none" |
| ShowGroupPanel="false" AllowPaging="true" AllowFilteringByColumn="false"> |
| <ClientSettings Scrolling-AllowScroll="True" Scrolling-UseStaticHeaders="true" Selecting-AllowRowSelect="true" |
| EnablePostBackOnRowClick="true" EnableRowHoverStyle="true" |
| ClientEvents-OnRowSelected="RowSelected" > |
| </ClientSettings> |
| <MasterTableView TableLayout="Fixed" GroupLoadMode="Client" DataKeyNames="job_id" > |
| <Columns> |
| <telerik:GridCheckBoxColumn DataField="isChecked" ReadOnly="false" HeaderText="My Job1" HeaderStyle-Width="60" UniqueName="mycheck1" ></telerik:GridCheckBoxColumn> |
| <telerik:GridClientSelectColumn HeaderText="My Job2" HeaderStyle-Width="60" UniqueName="mycheck2"></telerik:GridClientSelectColumn> |
| <telerik:GridTemplateColumn HeaderText="Check/UnCheck" UniqueName="TemplateColumn"> |
| <EditItemTemplate> |
| <asp:CheckBox id="editChkBox" runat="server" AutoPostBack="true" |
| Checked='<%# Bind("ischecked") %>' Enabled="true"> |
| </asp:CheckBox> |
| </EditItemTemplate> |
| <ItemTemplate> |
| <asp:CheckBox id="defaultChkBox" runat="server" Enabled="true" |
| Checked='<%# Eval("ischecked") %>'> |
| </asp:CheckBox> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridBoundColumn DataField="user_id" Headertext="userid" Visible="false"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="username" HeaderText="Username" HeaderStyle-Width="120px"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="Title" HeaderText="Title" > |
| </telerik:GridBoundColumn> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid> |