This is a migrated thread and some comments may be shown as answers.

Checkbox

2 Answers 108 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Toxic
Top achievements
Rank 1
Toxic asked on 07 Nov 2016, 11:37 AM

The checked things in the Grid has to be shown in te CheckBoxList.

In one click on the button everything what has been checked in the grid has to be shown on the CHeckboxlist2.

I made something but its not completed, what do I have to do next?

 

   <asp:Panel runat="server" ID="pnlSource">
                          
                    

                         
                          <telerik:RadGrid ID="ChangedList" runat="server" AutoGenerateColumns="false" OnPageIndexChanged="ChangedList_PageIndexChanged" OnNeedDataSource="ChangedList_NeedDataSource" GridLines="None" AllowPaging="true" RenderMode="Lightweight" PageSize="5" AllowSorting="True">
                <MasterTableView ClientDataKeyNames="Logging_ID" backcolor="PaleGreen"  ForeColor="black" BorderStyle="Solid" BorderColor="Green" AlternatingItemStyle-BackColor="MediumSeaGreen"   PagerStyle-BackColor ="LawnGreen"   HeaderStyle-ForeColor="green" HeaderStyle-BorderColor="Crimson">
                      
                    <Columns> 

                        
                         <telerik:GridCheckBoxColumn UniqueName="GridCheckBoxColumn" DataField="IsTrue">
            </telerik:GridCheckBoxColumn>   
                          
                      
                        
                        <telerik:GridBoundColumn DataField="ModuleName" HeaderText="Naam"  UniqueName="ModuleName" ReadOnly="true">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="AssemblyVersion" HeaderText="Versie" UniqueName="AssemblyVersion" ReadOnly="true">
                        </telerik:GridBoundColumn>

                        
                     
                    </Columns>
                </MasterTableView>
               <ClientSettings EnableRowHoverStyle="true" >
            <Selecting AllowRowSelect="True" />
        </ClientSettings>
            </telerik:RadGrid>
                         <br />       
                <div class="col-md-1" >
                    <asp:Button ID="ButtonALL" runat="server"  Text="Update"  OnClick="ButtonALL_OnClick"   />
                </div>




     

                 
                        
                        
                   
           
                      
                     <asp:Panel runat="server" ID ="pnlSourceNoItems">
                   <%--  //   <asp:Label runat="server" Text="Er zijn geen wijzigingen geconstateerd"/>--%>
                    </asp:Panel>
                     </div>
                </div>
                       
                <div class="col-md-1">
                    <h3>==></h3><asp:Button ID="btnUpdate" runat="server" Text="Update"  OnClick="btnUpdate_OnClick"  meta:resourcekey="btnUpdateResource1" />
                </div>

                <div class="col-md-6">
                    <div class="row">
                        <div class="col-md-6">
                            <h3>Websites</h3>
                        </div>
                        <div class="col-md-6">
                            <asp:DropDownList runat="server" id="ddWebserver" AutoPostBack="True"  OnSelectedIndexChanged="ddWebserver_OnSelectedIndexChanged"/>
                        </div>
                    </div>
                    
                    
                    
                 
                    <div style="border: black; border-width: 1px; border-style: solid; overflow: scroll; height:300px">
                        <asp:Panel runat="server" ID="pnlTarget">
                        <asp:CheckBoxList ID="CheckBoxList2" runat="server" meta:resourcekey="CheckBoxList2Resource1">
                            </asp:CheckBoxList>

                        </asp:Panel>
                        <asp:Panel runat="server" ID="pnlNoItems">
                            <asp:Label runat="server" Text="Er zijn geen webs waar de update kan worden toegepast" />
                        </asp:Panel>
                    </div>

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

        protected void ButtonALL_OnClick(object sender, EventArgs e)
        {

            ButtonALL.BackColor = System.Drawing.Color.PaleGreen;
            ButtonALL.BorderColor = System.Drawing.Color.Green;
            ButtonALL.ForeColor = System.Drawing.Color.Black;
            if (ButtonALL.Text == "Update")
            {

                ButtonALL.Text = "Updated";
            }
            else
            {

                ButtonALL.Text = "Update";
            }

            {
                foreach (GridItem item in ChangedList.MasterTableView.Items)
                {
                    GridDataItem dataitem = (GridDataItem)item;
                    TableCell cell = dataitem["GridCheckBoxColumn"];
                    CheckBox checkBox = (CheckBox)cell.Controls[0];
                    if (checkBox.Checked)
                    {
                        string value = dataitem.GetDataKeyValue("Logging_ID").ToString(); //Access the checked row using DataKeyNames
                        

                    }
                }

            }
        }
    

 

 

2 Answers, 1 is accepted

Sort by
0
Toxic
Top achievements
Rank 1
answered on 07 Nov 2016, 02:07 PM
*Not Checkboxlist2 but GridCheckBoxColumn*
0
Viktor Tachev
Telerik team
answered on 09 Nov 2016, 01:42 PM
Hello,

As I understand your requirement you would like to show the selected RadGrid items in a separate CheckBoxList control.

In that case you can use the approach described in the following article to keep track of all selected items in RadGrid. Once you have that, you can use the items to construct a data source manually and bind the CheckBoxList to it.



Regards,
Viktor Tachev
Telerik by Progress
Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
Tags
Grid
Asked by
Toxic
Top achievements
Rank 1
Answers by
Toxic
Top achievements
Rank 1
Viktor Tachev
Telerik team
Share this question
or