Hi,
I am having a radgrid(with detailtables) and a radcombobox with checkboxes in it. Initially on pageload, all the items in the radcombobox are clicked and the detail table shows all the columns in it. When the user unselects any of the item in the combo box, the column in the detail table should become invisible.
<telerik:RadComboBox ID="RadComboBox1" runat="server" HighlightTemplatedItems="true" EmptyMessage="select display columns"
Skin="Office2007" AllowCustomText="true" Width="240px">
<ItemTemplate>
<asp:CheckBox runat="server" ID="chk1" Checked="true" OnCheckedChanged="chk1_CheckedChanged" AutoPostBack="true"/>
<asp:Label runat="server" ID="Label1" Text='<%# Eval("menuitem_gridname") %>' AssociatedControlID="chk1">
</asp:Label>
</ItemTemplate>
</telerik:RadComboBox>
codebehind
protected void chk1_CheckedChanged(object sender, EventArgs e)
{
string str = "";
for (int i = 0; i < RadComboBox1.Items.Count; i++)
{
CheckBox chk = (CheckBox)RadComboBox1.Items[i].FindControl("chk1");
if (chk.Checked == false) {
str = str + "," + RadComboBox1.Items[i].Value;
}
}
RadGrid2.Rebind();
}
protected void RadGrid2_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e)
{
//string str = Request.QueryString["Cols"].ToString();
string str = "";
for (int i = 0; i < RadComboBox1.Items.Count;i++)
{
CheckBox chk = (CheckBox)RadComboBox1.Items[i].FindControl("chk1");
if (chk.Checked == false)
{
str = str + "," + RadComboBox1.Items[i].Value;
}
}
e.DetailTableView.DataSource = dsSwitch.Tables[1];
//string str = Request.QueryString["Cols"].ToString();
string[] cols = str.Split(',');
for (int i = 0; i < cols.Length; i++)
{
if (cols[i].ToString().Equals(string.Empty))
continue;
int j = int.Parse(cols[i].ToString());
e.DetailTableView.Columns[j].Visible = false;
}
//e.DetailTableView.Columns[3].Visible = false;
}
Now the problem is it is not remembering the state of the radgrid. For example, If we expand a particular row in the mastergrid and unselect an item in the combobox, none of the rows are in expanded state. It is not remember the state of the radgrid.
How to remeber the state of the grid on selecting and unselectiong the items in a combobox to hide the columns of a detail table in an ajax way?
Thank you.
| <telerik:RadComboBox ID="_sicCode" runat="server" AllowCustomText="false" MarkFirstMatch="false" EmptyMessage="-- Select --" Filter="Contains" MaxHeight="150" /> |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| GuardSchedule.DataKeyField = "ID"; |
| GuardSchedule.DataSubjectField = "Subject"; |
| GuardSchedule.DataStartField = "StartDateTime"; |
| GuardSchedule.DataEndField = "EndDateTime"; |
| GuardSchedule.SelectedView = SchedulerViewType.MonthView; |
| GuardSchedule.ShowViewTabs = false; |
| GuardSchedule.OverflowBehavior = OverflowBehavior.Expand; |
| GuardSchedule.ShowNavigationPane = false; |
| GuardSchedule.AllowDelete = false; |
| GuardSchedule.AllowEdit = false; |
| GuardSchedule.AllowInsert = false; |
| GuardSchedule.OnClientAppointmentClick = "AppointmentClicked"; GuardSchedule.DataBound += new EventHandler(GuardSchedule_DataBound); |
| } void GuardSchedule_DataBound(object sender, EventArgs e) { DateTime viewStartDateTime = GuardSchedule.VisibleRangeStart; DateTime viewEndDateTime = GuardSchedule.VisibleRangeEnd; _appMax = 2; int numApps = 0; DateTime startTime = viewStartDateTime; DateTime endTime = viewStartDateTime.AddDays(1); while (startTime <= viewEndDateTime) { numApps = GuardSchedule.Appointments.GetAppointmentsInRange(startTime, endTime).Count; if (numApps > _appMax) _appMax = numApps; startTime = startTime.AddDays(1); endTime = endTime.AddDays(1); } GuardSchedule.MonthView.VisibleAppointmentsPerDay = _appMax; } |
| <scipt> |
| function AppointmentClicked(sender, eventArgs) { |
| var apt = eventArgs.get_appointment(); |
| var aptID = apt.get_id(); |
| //Do stuff with the id |
| } |
| </script> <telerik:RadScheduler ID="GuardSchedule" runat="server" SelectedView="MonthView" ShowViewTabs="false"> </telerik:RadScheduler> |
I am using nested user controls and web controls in my PanelBar Items. They are reused outside of my Panelbar in other parts of the app. They already have style sheets and css classes assigned to them. When I drop the controls into the panel bar they no longer use those but inherit from the PanelBars default stylesheet. How to do I reference the other stylesheet? Is there a way to use a custom skin for the Panelbar but still have the nested controls use their own style sheet?
| <div id="ICEmploymentRole" runat="server"> |
| <telerik:RadPanelBar runat="server" ID="RadPanelBarICE" Width="1024px" ExpandMode="SingleExpandedItem" AllowCollapseAllItems="true"> |
| <Items> |
| <telerik:RadPanelItem Text="My Internal Controls Criteria" runat="server" > |
| <Items> |
| <telerik:RadPanelItem runat="server" Value="templateHolder" > |
| <ItemTemplate> |
| <div class="notificationcontainer"> |
| <asp:Label ID="lblICEConfirmationMsg" runat="server" Visible="False" CssClass="notification"></asp:Label> |
| <asp:Label ID="lblICEErrMsg" runat="server" CssClass="error" Visible="False"></asp:Label></div> |
| <asp:GridView ID="grdIceCriteriaList" runat="server" |
| OnRowDeleting="grdUserCriteriaList_RowDeleting" |
| OnRowEditing="grdUserCriteriaList_RowEditing" |
| OnRowDataBound="grdICECriteriaList_RowDataBound" |
| AutoGenerateColumns="False" |
| SkinID="gridviewContentSkin" |
| CssClass="contentTable"> |
| <Columns> |
| <asp:BoundField DataField="CriteriaName" HeaderText="Name" /> |
| <asp:BoundField DataField="VPAreaDesc" HeaderText="VP Area" SortExpression="VPAreaDesc" /> |
| <asp:BoundField DataField="OrgGrpDesc" HeaderText="Sch/Coll/Dept Grp" /> |
| <asp:BoundField DataField="DeptIDDesc" HeaderText="Dept" SortExpression="DeptIDDesc" /> |
| <asp:TemplateField HeaderText="Default"> |
| <ItemTemplate> |
| <asp:Literal ID="RadioButtonMarkup" runat="server" ></asp:Literal> |
| </ItemTemplate> |
| </asp:TemplateField> |
| <asp:TemplateField> |
| <EditItemTemplate> |
| <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update" |
| Text="Update"></asp:LinkButton> |
| </EditItemTemplate> |
| <ItemTemplate> |
| <asp:LinkButton ID="lnkbtnEdit" runat="server" CausesValidation="False" CommandName="Edit" |
| Text="Edit"></asp:LinkButton> |
| </ItemTemplate> |
| </asp:TemplateField> |
| <asp:TemplateField> |
| <ItemTemplate> |
| <asp:LinkButton ID="lnkbtnDel" runat="server" CausesValidation="False" CommandName="Delete" |
| OnClientClick="return DeleteDataConfirmation(this)" Text="Delete"></asp:LinkButton> |
| </ItemTemplate> |
| </asp:TemplateField> |
| </Columns> |
| </asp:GridView> |
| <div class="centered"> |
| <asp:LinkButton ID="lnkbtnAddICECriteria" runat="server" OnClick="lnkbtnAddICECriteria_Click" CssClass="contentlink">Click to add new criteria</asp:LinkButton></div> |
| <div class="mysettingsfloat"> |
| <uc2:ParamBar ID="ParamBar1" runat="server" Visible="false" /> |
| </div> |
| </ItemTemplate> |
| </telerik:RadPanelItem> |
| </Items> |
| </telerik:RadPanelItem> |
| </Items> |
| </telerik:RadPanelBar> |
| </div> |