| <telerik:RadScheduler runat="server" ID="rsDonationSchedule" DayStartTime="08:00:00" |
| DayEndTime="18:00:00" TimeZoneOffset="03:00:00" DataSourceID="edsDonationSchedule" |
| DataKeyField="DonationScheduleId" DataStartField="Start" DataEndField="End" DataSubjectField="Subject" |
| CustomAttributeNames="Donors" OnAppointmentInsert="rsDonationSchedule_OnAppointmentInsert" > |
| <AdvancedForm Modal="true" /> |
| <AppointmentTemplate> |
| <%# Eval("Subject") %><%# Eval("Donors.SurName")%> |
| </AppointmentTemplate> |
| <InlineInsertTemplate> |
| <span> |
| <table> |
| <tr> |
| <td> |
| <asp:Label ID="Label3" AssociatedControlID="TitleTextBox" runat="server">Onderwerp</asp:Label><asp:TextBox |
| ID="TitleTextBox" runat="server" Text='<%# Bind("Subject") %>' Width="90%" Height="20px"></asp:TextBox> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <asp:Label ID="Label4" AssociatedControlID="rcbDonors" runat="server">Donor</asp:Label><telerik:RadComboBox |
| ID="rcbDonors" runat="server" DataSourceID="edsDonoren" DataTextField="DonorScheduleLabel" |
| DataValueField="DonorId" MarkFirstMatch="true" SelectedValue="<%# Bind('Donors.DonorId') %>" /> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <asp:Label ID="Label5" AssociatedControlID="txtDescription" runat="server">Info</asp:Label><asp:TextBox |
| ID="txtDescription" runat="server" Text='<%# Bind("Description") %>' Width="90%" |
| TextMode="MultiLine" Height="20px"></asp:TextBox> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert"> |
| <asp:Image runat="server" ID="insertImage" ImageUrl="Images/ok.png" AlternateText="insert" /> |
| </asp:LinkButton> |
| <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"> |
| <asp:Image runat="server" ID="Image2" ImageUrl="Images/cancel.png" AlternateText="cancel" /> |
| </asp:LinkButton> |
| </td> |
| </tr> |
| </table> |
| </span> |
| </InlineInsertTemplate> |
| gridHubSitesGroup.Items[0].Cells[0].Text = "0"; |
| gridHubSitesGroup.Items[0].Cells[1].Text = sq_str1.ExecuteScalar().ToString(); |
<Scrolling AllowScroll="True" UseStaticHeaders="true" />
an empty column is added to the grid header row, on the left side as if it's left to right grid (English) and it's not suitable for Hebrew.
Attached is a screenshot for demonstrating the problem.
As you can see, the scroll is added correctly on the left side of the grid, but the rectangular added to the header row is put on the right side of the grid.
Thank you!
Hi, I'm using a RadComboBox with MaxHeight defined. If the width of the text in the items is bigger than the width of the dropdown list, a auto horizontal scrollbar will appear, that's nice and desirable, but, if there is just one item and the horizontal scrollbar appears, the item will be hidden by the scrollbar.
There is someway to continue using MaxHeight without this problem?
I attached a image that shows what I mean.

| <%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadGridSolutionTelerikLines.aspx.cs" Inherits="RadGridSolutionTelerikLines" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head> |
| <title></title> |
| <style type="text/css"> |
| .StaticColumn |
| { |
| font-family: Arial,Verdana, Helvetica; |
| font-size: 14px; |
| font-weight: normal; |
| border: none; |
| position: relative; |
| } |
| .RadGrid td{padding:0} |
| .rgExpand |
| { |
| background:url('Images/CollapsedButton.gif') center no-repeat !important; |
| } |
| .rgCollapse |
| { |
| background:url('Images/ExpandedButton.gif') center no-repeat !important; |
| } |
| .RadGrid_Vista tr.DetailRow |
| { |
| background:#ebe4d6; |
| } |
| .DetailTable_Vista |
| { |
| background:#f4ede1; |
| } |
| .RadGrid_Vista .DetailTable_Vista .GridHeader_Vista, |
| .RadGrid_Vista .DetailTable_Vista .ResizeHeader_Vista |
| { |
| padding-top:2px; |
| padding-bottom:2px; |
| background-position:0 -6px; |
| } |
| </style> |
| </head> |
| <body> |
| <form runat="server" id="mainForm" method="post"> |
| <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> |
| <!-- content start --> |
| <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> |
| <AjaxSettings> |
| <telerik:AjaxSetting AjaxControlID="RadGrid1"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> |
| <telerik:AjaxUpdatedControl ControlID="RadGrid2" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| </AjaxSettings> |
| </telerik:RadAjaxManager> |
| <!-- DataSourceID="SqlDataSource1" --> |
| <table border="0" cellspacing="0" cellpadding="0" style="height:100%;"> |
| <tr> |
| <td style="vertical-align:top;height:100%"> |
| <telerik:RadGrid ID="RadGrid1" Skin="Vista" OnPreRender="RadGrid1_PreRender" |
| runat="server" DataSourceID="SqlDataSource1" OnColumnCreated="RadGrid1_ColumnCreated" |
| OnItemCreated="RadGrid1_ItemCreated" OnItemDataBound="RadGrid1_ItemDataBound" |
| Width="100%" onselectedindexchanged="RadGrid1_SelectedIndexChanged"> |
| <MasterTableView HierarchyDefaultExpanded="false" EnableNoRecordsTemplate="false" HierarchyLoadMode="ServerBind" AllowSorting="true" Width="800px" |
| DataKeyNames="EmployeeID" ExpandCollapseColumn-ButtonType="ImageButton" ExpandCollapseColumn-Display="true" |
| ExpandCollapseColumn-ExpandImageUrl="Images/CollapsedButton.gif" ExpandCollapseColumn-CollapseImageUrl="Images/ExpandedButton.gif"> |
| <ItemStyle Wrap="false" Width="200px" BackColor="Azure" Height="17px" BorderWidth="1"/> |
| <AlternatingItemStyle Wrap="false" BackColor="BlanchedAlmond" Width="200px" Height="17px" BorderWidth="1"/> |
| <HeaderStyle Wrap="false" Width="1500px" Height="20px"/> |
| <SelfHierarchySettings ParentKeyName="ReportsTo" KeyName="EmployeeID"/> |
| </MasterTableView> |
| <ClientSettings AllowExpandCollapse="true" EnablePostBackOnRowClick="true" EnableRowHoverStyle="true"> |
| <Selecting AllowRowSelect="true" /> |
| </ClientSettings> |
| </telerik:RadGrid> |
| </td> |
| <td class="StaticColumn" style="vertical-align:top;height:auto;"> |
| <telerik:RadGrid ID="RadGrid2" ShowStatusBar="true" EnableViewState="true" |
| runat="server" AutoGenerateColumns="true" AllowSorting="False" AllowMultiRowSelection="False" Width="800px" GridLines="None"> |
| <MasterTableView ItemStyle-Wrap="false" Height="20px"> |
| <HeaderStyle Wrap="false" Height="20px"/> |
| <AlternatingItemStyle Height="17px" BackColor="BlanchedAlmond" Wrap="false" /> |
| <ItemStyle Height="17px" BackColor="Azure" Wrap="false" /> |
| <Columns> |
| <telerik:GridBoundColumn SortExpression="EmployeeID" HeaderText="EmployeeID" HeaderButtonType="TextButton" |
| DataField="EmployeeID" UniqueName="EmployeeID" ItemStyle-Wrap="false" ItemStyle-Width="200px" ItemStyle-Height="17px"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn SortExpression="LastName" HeaderText="LastName" HeaderButtonType="TextButton" |
| DataField="LastName" UniqueName="LastName" ItemStyle-Wrap="false" ItemStyle-Width="200px" ItemStyle-Height="17px"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn SortExpression="FirstName" HeaderText="FirstName" HeaderButtonType="TextButton" |
| DataField="FirstName" UniqueName="FirstName" ItemStyle-Wrap="false" ItemStyle-Width="200px" ItemStyle-Height="17px"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn SortExpression="Title" HeaderText="Title" HeaderButtonType="TextButton" |
| DataField="Title" UniqueName="Title" ItemStyle-Wrap="false" ItemStyle-Width="200px" ItemStyle-Height="17px"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn SortExpression="ReportsTo" HeaderText="ReportsTo" HeaderButtonType="TextButton" |
| DataField="ReportsTo" UniqueName="ReportsTo" ItemStyle-Wrap="false" ItemStyle-Width="200px" ItemStyle-Height="17px"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn SortExpression="EmployeeID" HeaderText="EmployeeID" HeaderButtonType="TextButton" |
| DataField="EmployeeID" UniqueName="EmployeeID" ItemStyle-Wrap="false" ItemStyle-Width="200px" ItemStyle-Height="17px"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn SortExpression="LastName" HeaderText="LastName" HeaderButtonType="TextButton" |
| DataField="LastName" UniqueName="LastName" ItemStyle-Wrap="false" ItemStyle-Width="200px" ItemStyle-Height="17px"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn SortExpression="FirstName" HeaderText="FirstName" HeaderButtonType="TextButton" |
| DataField="FirstName" UniqueName="FirstName" ItemStyle-Wrap="false" ItemStyle-Width="200px" ItemStyle-Height="17px"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn SortExpression="Title" HeaderText="Title" HeaderButtonType="TextButton" |
| DataField="Title" UniqueName="Title" ItemStyle-Wrap="false" ItemStyle-Width="200px" ItemStyle-Height="17px"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn SortExpression="ReportsTo" HeaderText="ReportsTo" HeaderButtonType="TextButton" |
| DataField="ReportsTo" UniqueName="ReportsTo" ItemStyle-Wrap="false" ItemStyle-Width="200px" ItemStyle-Height="17px"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn SortExpression="EmployeeID" HeaderText="EmployeeID" HeaderButtonType="TextButton" |
| DataField="EmployeeID" UniqueName="EmployeeID" ItemStyle-Wrap="false" ItemStyle-Width="200px" ItemStyle-Height="17px"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn SortExpression="LastName" HeaderText="LastName" HeaderButtonType="TextButton" |
| DataField="LastName" UniqueName="LastName" ItemStyle-Wrap="false" ItemStyle-Width="200px" ItemStyle-Height="17px"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn SortExpression="FirstName" HeaderText="FirstName" HeaderButtonType="TextButton" |
| DataField="FirstName" UniqueName="FirstName" ItemStyle-Wrap="false" ItemStyle-Width="200px" ItemStyle-Height="17px"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn SortExpression="Title" HeaderText="Title" HeaderButtonType="TextButton" |
| DataField="Title" UniqueName="Title" ItemStyle-Wrap="false" ItemStyle-Width="200px" ItemStyle-Height="17px"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn SortExpression="ReportsTo" HeaderText="ReportsTo" HeaderButtonType="TextButton" |
| DataField="ReportsTo" UniqueName="ReportsTo" ItemStyle-Wrap="false" ItemStyle-Width="200px" ItemStyle-Height="17px"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn SortExpression="EmployeeID" HeaderText="EmployeeID" HeaderButtonType="TextButton" |
| DataField="EmployeeID" UniqueName="EmployeeID" ItemStyle-Wrap="false" ItemStyle-Width="200px" ItemStyle-Height="17px"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn SortExpression="LastName" HeaderText="LastName" HeaderButtonType="TextButton" |
| DataField="LastName" UniqueName="LastName" ItemStyle-Wrap="false" ItemStyle-Width="200px" ItemStyle-Height="17px"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn SortExpression="FirstName" HeaderText="FirstName" HeaderButtonType="TextButton" |
| DataField="FirstName" UniqueName="FirstName" ItemStyle-Wrap="false" ItemStyle-Width="200px" ItemStyle-Height="17px"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn SortExpression="Title" HeaderText="Title" HeaderButtonType="TextButton" |
| DataField="Title" UniqueName="Title" ItemStyle-Wrap="false" ItemStyle-Width="200px" ItemStyle-Height="17px"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn SortExpression="ReportsTo" HeaderText="ReportsTo" HeaderButtonType="TextButton" |
| DataField="ReportsTo" UniqueName="ReportsTo" ItemStyle-Wrap="false" ItemStyle-Width="200px" ItemStyle-Height="17px"> |
| </telerik:GridBoundColumn> |
| </Columns> |
| </MasterTableView> |
| <clientsettings allowexpandcollapse="false" EnableRowHoverStyle="true"> |
| <Scrolling AllowScroll="true" UseStaticHeaders="True"></Scrolling> |
| </clientsettings> |
| </telerik:RadGrid> |
| </td> |
| </tr> |
| </table> |
| <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" |
| ProviderName="System.Data.SqlClient" SelectCommand="SELECT EmployeeID, LastName, FirstName, Title, ReportsTo FROM Employees" |
| runat="server"></asp:SqlDataSource> |
| <!-- content end --> |
| </form> |
| </body> |
| </html> |
| using System; |
| using System.Collections.Generic; |
| using System.Linq; |
| using System.Web; |
| using System.Web.UI; |
| using System.Web.UI.WebControls; |
| using Telerik.Web.UI; |
| using System.Reflection; |
| using System.Data; |
| using System.Data.SqlClient; |
| public partial class RadGridSolutionTelerikLines : System.Web.UI.Page |
| { |
| public void Page_Load(object sender, EventArgs e) |
| { |
| bindGrid2(); |
| if (Assembly.GetAssembly(typeof(ScriptManager)).FullName.IndexOf("3.5") != -1) |
| { |
| RadGrid1.MasterTableView.FilterExpression = @"it[""ReportsTo""] = Convert.DBNull"; |
| } |
| else |
| { |
| RadGrid1.MasterTableView.FilterExpression = "ReportsTo IS NULL"; |
| } |
| if (RadGrid1.MasterTableView.DetailTables != null) |
| { |
| RadGrid1.MasterTableView.DetailTables[0].AlternatingItemStyle.BackColor = System.Drawing.Color.Azure ; |
| RadGrid1.MasterTableView.DetailTables[0].ItemStyle.BackColor = System.Drawing.Color.BlanchedAlmond; |
| if (RadGrid1.MasterTableView.DetailTables[0].DetailTables[0] != null) |
| { |
| RadGrid1.MasterTableView.DetailTables[0].DetailTables[0].AlternatingItemStyle.BackColor = System.Drawing.Color.Azure; |
| RadGrid1.MasterTableView.DetailTables[0].DetailTables[0].ItemStyle.BackColor = System.Drawing.Color.BlanchedAlmond; |
| } |
| } |
| } |
| public void Page_PreRenderComplete(object sender, EventArgs e) |
| { |
| HideExpandColumnRecursive(RadGrid1.MasterTableView); |
| string ActualNodes = string.Empty; |
| foreach (GridDataItem dataItem in RadGrid1.Items) |
| { |
| if (dataItem.Visible) |
| { |
| ActualNodes += dataItem["EmployeeID"].Text + ","; |
| } |
| } |
| if (ActualNodes.Length > 0) |
| ActualNodesActualNodes = ActualNodes.Substring(0, ActualNodes.Length - 1); |
| RadGrid2.Controls.Clear(); |
| RadGrid2.DataSource = getDetails(ActualNodes); |
| RadGrid2.DataBind(); |
| if (Session["RadGrid1_SelectedValue"] != null) |
| { |
| for (int m = 0; m < RadGrid2.Items.Count; m++) |
| { |
| if (RadGrid2.Items[m]["EmployeeID"].Text.Equals(Session["RadGrid1_SelectedValue"].ToString())) |
| { |
| RadGrid2.Items[m].Selected = true; |
| } |
| } |
| } |
| } |
| public void HideExpandColumnRecursive(GridTableView tableView) |
| { |
| GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView); |
| foreach (GridNestedViewItem nestedViewItem in nestedViewItems) |
| { |
| foreach (GridTableView nestedView in nestedViewItem.NestedTableViews) |
| { |
| nestedView.Style["border"] = "0"; |
| Button MyExpandCollapseButton = (Button)nestedView.ParentItem.FindControl("MyExpandCollapseButton"); |
| if (nestedView.Items.Count == 0) |
| { |
| if (MyExpandCollapseButton != null) |
| { |
| MyExpandCollapseButton.Style["visibility"] = "hidden"; |
| } |
| nestedViewItem.Visible = false; |
| } |
| else |
| { |
| if (MyExpandCollapseButton != null) |
| { |
| MyExpandCollapseButton.Style.Remove("visibility"); |
| } |
| } |
| if (nestedView.HasDetailTables) |
| { |
| HideExpandColumnRecursive(nestedView); |
| } |
| } |
| } |
| } |
| protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) |
| { |
| CreateExpandCollapseButton(e.Item, "EmployeeID"); |
| if (e.Item is GridHeaderItem && e.Item.OwnerTableView != RadGrid1.MasterTableView) |
| { |
| e.Item.Style["display"] = "none"; |
| } |
| if (e.Item is GridNestedViewItem) |
| { |
| e.Item.Cells[0].Visible = false; |
| Table table = (Table)e.Item.OwnerTableView.Controls[0]; |
| GridItem prevItem = (GridItem)table.Rows[table.Rows.Count - 2]; |
| // Why -3? We need to skip the NestedViewItem and the preceding DataItem's invisible EditItem |
| if (prevItem.ItemType == GridItemType.AlternatingItem) |
| { |
| e.Item.CssClass = "DetailAltRow"; |
| } |
| else |
| { |
| e.Item.CssClass = "DetailRow"; |
| } |
| /* |
| e.Item.Cells[0].CssClass = "DetailRowCell"; |
| e.Item.Cells[1].CssClass = "DetailRowCell"; |
| */ |
| } |
| } |
| protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e) |
| { |
| if (e.Column is GridExpandColumn) |
| { |
| e.Column.Visible = false; |
| } |
| else if (e.Column is GridBoundColumn) |
| { |
| e.Column.HeaderStyle.Width = Unit.Pixel(100); |
| } |
| } |
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| CreateExpandCollapseButton(e.Item, "EmployeeID"); |
| } |
| public void CreateExpandCollapseButton(GridItem item, string columnUniqueName) |
| { |
| if (item is GridDataItem) |
| { |
| if (item.FindControl("MyExpandCollapseButton") == null) |
| { |
| Button button = new Button(); |
| button.Click += new EventHandler(button_Click); |
| button.CommandName = "ExpandCollapse"; |
| button.CssClass = (item.Expanded) ? "rgCollapse" : "rgExpand"; |
| button.ID = "MyExpandCollapseButton"; |
| if (item.OwnerTableView.HierarchyLoadMode == GridChildLoadMode.Client) |
| { |
| string script = String.Format(@"$find(""{0}"")._toggleExpand(this, event); return false;", item.Parent.Parent.ClientID); |
| button.OnClientClick = script; |
| } |
| int level = item.ItemIndexHierarchical.Split(':').Length; |
| if (level > 1) |
| { |
| button.Style["margin-left"] = level + 10 + "px"; |
| button.Style["height"] = "15px"; |
| } |
| TableCell cell = ((GridDataItem)item)[columnUniqueName]; |
| cell.Controls.Add(button); |
| LiteralControl liSpace = new LiteralControl(" "); |
| cell.Controls.Add(liSpace); |
| cell.Controls.Add(new LiteralControl(((GridDataItem)item).GetDataKeyValue(columnUniqueName).ToString())); |
| cell.Style["height"] = "15px"; |
| } |
| } |
| } |
| protected void RadGrid1_PreRender(object sender, EventArgs e) |
| { |
| string ActualNodes = string.Empty; |
| foreach (GridDataItem dataItem in RadGrid1.Items) |
| { |
| if (dataItem.Visible) |
| { |
| ActualNodes += dataItem["EmployeeID"].Text + ","; |
| } |
| } |
| if (ActualNodes.Length > 0) |
| ActualNodesActualNodes = ActualNodes.Substring(0, ActualNodes.Length - 1); |
| RadGrid2.Controls.Clear(); |
| RadGrid2.DataSource = getDetails(ActualNodes); |
| RadGrid2.DataBind(); |
| //Response.Write("<script> alert(" + sTest + ");</script>"); |
| } |
| void button_Click(object sender, EventArgs e) |
| { |
| ((Button)sender).CssClass = (((Button)sender).CssClass == "rgExpand") ? "rgCollapse" : "rgExpand"; |
| } |
| private void bindGrid2() |
| { |
| RadGrid2.Controls.Clear(); |
| string initialNodes = string.Empty; |
| for (int m = 0; m < RadGrid1.Items.Count; m++) |
| { |
| if (!RadGrid1.Items[m]["EmployeeID"].Text.ToLower().Equals(" ") && RadGrid1.Items[m].Visible) |
| initialNodes += RadGrid1.Items[m]["EmployeeID"].Text + ","; |
| } |
| if (initialNodes.Length > 0) |
| { |
| RadGrid2.DataSource = getEmployees(initialNodes.Substring(0, initialNodes.Length - 1)); |
| } |
| else |
| RadGrid2.DataSource = getEmployees(""); |
| RadGrid2.DataBind(); |
| } |
| private DataView getEmployees(string initialNodes) |
| { |
| DataSet ds = new DataSet(); |
| string sqlFinal = string.Empty; |
| if (!initialNodes.Equals(string.Empty)) |
| { |
| sqlFinal = "Where EmployeeID in (" + initialNodes + ")"; |
| } |
| using (SqlConnection conn = new SqlConnection()) |
| { |
| conn.ConnectionString = GetConnectionString(); |
| SqlCommand cmd = new SqlCommand("SELECT [EmployeeID], [LastName], [FirstName], [Title], [ReportsTo] FROM [Employees] " + sqlFinal, conn); |
| conn.Open(); |
| SqlDataAdapter sqlAdapter = new SqlDataAdapter(cmd); |
| sqlAdapter.Fill(ds); |
| } |
| DataView dv = new DataView(ds.Tables[0]); |
| return dv; |
| } |
| private DataTable getChildNodesByID(string ParentID) |
| { |
| DataSet ds = new DataSet(); |
| string sql = "SELECT [EmployeeID], [LastName], [FirstName], [Title], [ReportsTo] FROM [Employees] Where ReportsTo = " + ParentID; |
| using (SqlConnection conn = new SqlConnection()) |
| { |
| conn.ConnectionString = GetConnectionString(); |
| SqlCommand cmd = new SqlCommand(sql, conn); |
| conn.Open(); |
| SqlDataAdapter sqlAdapter = new SqlDataAdapter(cmd); |
| sqlAdapter.Fill(ds); |
| } |
| DataTable dt = new DataTable(); |
| if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) |
| return ds.Tables[0]; |
| else |
| return null; |
| } |
| private DataView getDetails(string ActualNodes) |
| { |
| DataSet ds = new DataSet(); |
| //string noeuds = ActualNodes.Substring(0, ActualNodes.Length - 1); |
| string[] tabNoeuds = ActualNodes.Split(','); |
| string swhen = " CASE "; |
| for (int i = 0; i < tabNoeuds.Length; i++) |
| { |
| swhen += " WHEN EmployeeID = " + tabNoeuds[i] + " THEN " + (i + 1) + " "; |
| } |
| swhen += " END "; |
| string sql = "SELECT [EmployeeID], [LastName], [FirstName], [Title], [ReportsTo] FROM [Employees] Where EmployeeID in (" + ActualNodes + ")"; |
| sql += " ORDER BY " + swhen; |
| using (SqlConnection conn = new SqlConnection()) |
| { |
| conn.ConnectionString = GetConnectionString(); |
| SqlCommand cmd = new SqlCommand(sql, conn); |
| conn.Open(); |
| SqlDataAdapter sqlAdapter = new SqlDataAdapter(cmd); |
| sqlAdapter.Fill(ds); |
| } |
| DataView dv = new DataView(ds.Tables[0]); |
| return dv; |
| } |
| static private string GetConnectionString() |
| { |
| return "server=STATION00374;database=Northwind;Integrated Security=SSPI;"; |
| } |
| protected void RadGrid1_SelectedIndexChanged(object sender, EventArgs e) |
| { |
| if (Session["RadGrid1_SelectedValue"] != null) |
| Session.Remove("RadGrid1_SelectedValue"); |
| Session["RadGrid1_SelectedValue"] = RadGrid1.SelectedValue.ToString(); |
| } |
| } |
Hi
I am having the issue in Hide/Unhide column in RadGrid. I came to know the problem comes only after setting the custom styles for HeaderStyle template. Otherwise it is working awesomely.
I used the following styles for Headers
.HeaderStyle
{
padding-top: 5px! important;
display: block! important;
text-decoration: none! important;
font-weight: bold! important;
}
Also I used to apply the style as below
<HeaderStyle CssClass="HeaderStyle" />
So when I remove the Header Style section no problem finding in it. So how can I make both the functionalities working fine?
-Thanks in Advance