The selected names of the Radgrid: ChangedList has to be shown in the Radgrid: Updatelist. that has to happen in one click on the button: ButtonALL_OnClick. What do I have to change to make it work?
RadGrid: ChangedList
<telerik:RadGrid ID="ChangedList" AllowMultiRowSelection="True" runat="server" AutoGenerateColumns="false" OnPageIndexChanged="ChangedList_PageIndexChanged" OnNeedDataSource="ChangedList_NeedDataSource" GridLines="None" AllowPaging="true" RenderMode="Lightweight" PageSize="5" AllowSorting="True">
<MasterTableView ClientDataKeyNames="Logging_ID, ModuleName, AssemblyVersion" >
<Columns>
<telerik:GridClientSelectColumn UniqueName="GridClientSelectColumn" >
</telerik:GridClientSelectColumn>
<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 >
<Selecting AllowRowSelect="True" />
</ClientSettings>
</telerik:RadGrid>
Button: ButtonALL
<br />
<div class="col-md-1" >
<asp:Button ID="ButtonALL" runat="server" Text="Update" OnClick="ButtonALL_OnClick" />
</div>
RadGrid: Updatlist
<telerik:RadGrid ID="Updatelist" AllowMultiRowSelection="True" runat="server" AutoGenerateColumns="true" OnPageIndexChanged="Updatelist_PageIndexChanged" OnNeedDataSource="Updatelist_NeedDataSource" GridLines="None" AllowPaging="true" RenderMode="Lightweight" PageSize="5" AllowSorting="True">
<MasterTableView ClientDataKeyNames="">
<Columns>
<telerik:GridClientSelectColumn UniqueName="GridClientSelectColumn">
</telerik:GridClientSelectColumn>
<telerik:GridBoundColumn DataField="" HeaderText="" UniqueName="" ReadOnly="true">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="" HeaderText="" UniqueName="" ReadOnly="true">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings>
<Selecting AllowRowSelect="True" />
</ClientSettings>
</telerik:RadGrid>
This is the CS code for the ButtonALL
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["GridClientSelectColumn"];
CheckBoxList checkBox = (CheckBoxList)cell.Controls[0];
if (checkBoxList.Checked)
{
string value = dataitem.GetDataKeyValue("Logging_ID").ToString();
string text = dataitem.GetDataKeyValue("ModuleName").ToString() + ", " + dataitem.GetDataKeyValue("AssemblyVersion").ToString();
}
DataTable dt = new DataTable();
dt.Columns.Add("AssemblyVersion", typeof(string));
dt.Columns.Add("ModuleName", typeof(int));
DataRow dr = dt.NewRow();
dr = dt.NewRow();
dt.Rows.Add(dr);
Updatelist.DataSource = dt;
Updatelist.DataBind();
}
pnlNoItems.Visible = (Updatelist.Items.Count == 0);
pnlTarget.Visible = !pnlNoItems.Visible;
}
(it was first A checkbox)
Aucun commentaire:
Enregistrer un commentaire