| <telerik:RadGrid ID="rgrdPayroll" runat="server" AutoGenerateColumns="False" DataSourceID="odsPersonnelByPI" |
| GridLines="None"> |
| <MasterTableView DataSourceID="odsPersonnelByPI" DataKeyNames="DisplayName" HierarchyLoadMode="ServerBind"> |
| <DetailTables> |
| <telerik:GridTableView runat="server" DataSourceID="odsPayrollByPI" GridLines="None"> |
| <ParentTableRelation> |
| <telerik:GridRelationFields DetailKeyField="DisplayName" MasterKeyField="DisplayName" /> |
| </ParentTableRelation> |
| <Columns> |
| <telerik:GridBoundColumn DataField="SlAcct6No" HeaderText="Account" UniqueName="SlAcct6No"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="AcctName" HeaderText="Account Name" UniqueName="AcctName"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="Pay" DataType="System.Decimal" HeaderText="Pay" |
| ReadOnly="True" SortExpression="Pay" UniqueName="Pay" DataFormatString="{0:$#,#.#0;-$#,#.#0;$0.00}"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="Benfit" DataType="System.Decimal" HeaderText="Benefit" |
| ReadOnly="True" SortExpression="Benfit" UniqueName="Benfit" DataFormatString="{0:$#,#.#0;-$#,#.#0;$0.00}"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="Total" DataType="System.Decimal" HeaderText="Total" |
| ReadOnly="True" SortExpression="Total" UniqueName="Total" DataFormatString="{0:$#,#.#0;-$#,#.#0;$0.00}"> |
| </telerik:GridBoundColumn> |
| </Columns> |
| </telerik:GridTableView> |
| </DetailTables> |
| <ExpandCollapseColumn Visible="True"> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridBoundColumn DataField="DisplayName" HeaderText="Personnel" SortExpression="DisplayName" |
| UniqueName="DisplayName"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="Total" DataType="System.Decimal" HeaderText="Total" |
| ReadOnly="True" SortExpression="Total" UniqueName="Total Salary" DataFormatString="{0:$#,#.#0;-$#,#.#0;$0.00}"> |
| </telerik:GridBoundColumn> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid> |
| protected void btnPDFPersonnel_Click(object sender, EventArgs e) |
| { |
| rgrdPayroll.ExportSettings.FileName = ddlPIs.SelectedValue.Substring(0, ddlPIs.SelectedValue.IndexOf(',')) + "_Personnel"; |
| rgrdPayroll.ExportSettings.OpenInNewWindow = true; |
| rgrdPayroll.ExportSettings.ExportOnlyData = true; |
| rgrdPayroll.ExportSettings.IgnorePaging = false; |
| rgrdPayroll.ExportSettings.Pdf.PageWidth = Unit.Parse("297mm"); |
| rgrdPayroll.ExportSettings.Pdf.PageHeight = Unit.Parse("216mm"); |
| foreach (GridItem item in rgrdPayroll.MasterTableView.Items) |
| { |
| item.Expanded = true; |
| } |
| rgrdPayroll.MasterTableView.ExportToPdf(); |
| } |
For a project I'm working on, we're looking for a way to dynamically add filters to a page which then control the dataoutput in a RadGrid. We want to add the filters dynamically because we want the customer to be able to change which properties can be filtered and what filtertype (textbox, dropdown, colourpicker, etc.) should be used.
The filter should work as follows:
The customer links a filter to a certain property and specifies the filtertype (for this example: dropdown). This is specified in a database table.
I have the following problems:
When I create the filters runtime, events are lost because the controls get recreated each postback.
Any help in one of the above would be great!
PS: One thing I thought about was passing along filter values in the postback which would have to be recognizable. That way the server could use them for selection and then create the filters and autoselect the previously selected filtervalues. I'm not quite sure how to acheive this though...


| <telerik:RadGrid ID="rgScenario" runat="server" Width="100%" Skin="Custom" EnableEmbeddedSkins="false" |
| AutoGenerateColumns="false" AllowSorting="false" AllowPaging="false" AllowFilteringByColumn="false" OnDetailTableDataBind="rgScenario_DetailTableDataBind" OnNeedDataSource="rgScenario_NeedDataSource"> |
| <MasterTableView DataKeyNames="xxxx" runat="server" EnableColumnsViewState="true"> |
| <DetailTables> |
| <telerik:GridTableView DataKeyNames="yyyy" runat="server" Name="Detail1" Width="100%" EnableColumnsViewState="true" > |
| <DetailTables> |
| <telerik:GridTableView DataKeyNames="zzzz" runat="server" Name="Detail2" Width="100%" EnableColumnsViewState="true"> |
| <Columns> |
| <telerik:GridBoundColumn HeaderText="Area" DataField="Area" UniqueName="Area"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="Days" DataField="Days" UniqueName="Days"></telerik:GridBoundColumn> |
| </Columns> |
| </telerik:GridTableView> |
| </DetailTables> |
| <Columns> |
| <telerik:GridBoundColumn HeaderText="Start Area" DataField="StartAreaName" UniqueName="StartAreaName"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="End Area" DataField="EndAreaName" UniqueName="EndAreaName"></telerik:GridBoundColumn> |
| </Columns> |
| </telerik:GridTableView> |
| </DetailTables> |
| <Columns> |
| <telerik:GridBoundColumn HeaderText="Vessel" DataField="VesselType" UniqueName="Vessel"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="Days" DataField="TotalVoyageDaysNum" UniqueName="TotalVoyageDaysNum"></telerik:GridBoundColumn> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid> |
| public partial class ComparisonReport : System.Web.UI.Page |
| { |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| try |
| { |
| if (!IsPostBack) |
| { |
| //Populate data into an IList say ParentIList |
| ShowHideRiskColumns(input); |
| } |
| rgScenario.DataSource = ParentIList; |
| } |
| } |
| catch(Exception ex) |
| { |
| } |
| } |
| private void ShowHideRiskColumns(string input) |
| { |
| GridBoundColumn parentDynamicColumn = new GridBoundColumn(); |
| parentDynamicColumn.HeaderText = "Some text"; |
| parentDynamicColumn.UniqueName = "Some text"; |
| parentDynamicColumn.DataFormatString = "{0:#,###.##}"; |
| GridBoundColumn childDynamicColumn= new GridBoundColumn(); |
| childDynamicColumn.HeaderText = "Some text"; |
| childDynamicColumn.UniqueName = "Some text"; |
| GridBoundColumn subChildDynamicColumn = new GridBoundColumn(); |
| subChildDynamicColumn.HeaderText = "Some text"; |
| subChildDynamicColumn.UniqueName = "Some text"; |
| rgScenario.MasterTableView.Columns.Add(parentDynamicColumn); |
| rgScenario.MasterTableView.DetailTables[0].Columns.Add(childDynamicColumn); |
| rgScenario.MasterTableView.DetailTables[0].DetailTables[0].Columns.Add(subChildDynamicColumn); |
| switch(input) |
| { |
| case 1: |
| //Set the datafield according to the input |
| break; |
| case 2: |
| //Set the datafield according to the input |
| break; |
| } |
| } |
| protected void rgScenario_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) |
| { |
| if (!e.IsFromDetailTable) |
| { |
| rgScenario.DataSource = iList; |
| } |
| } |
| protected void rgScenario_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e) |
| { |
| GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem; |
| switch (e.DetailTableView.Name) |
| { |
| case "Detail1": |
| { |
| e.DetailTableView.DataSource = detailList1; |
| break; |
| } |
| case "Detail2": |
| { |
| e.DetailTableView.DataSource = detailList2; |
| break; |
| } |
| } |
| } |
| } |
Hi,
1.I am using RadScheduler.
2. In my page. I have usedmy own css class file.
2.I have set the propertyfor H2 in Css file (for standard heding to all the pages).
h2{
margin:0px0px 0px 0px;
padding:0px0px 0px 10px;
width:406px;
height:28px;
background-image:url(../images/welcom.png);background-repeat:no-repeat;
font-size:18px;font-weight:bold;
line-height:1.4em;
}
3.If I applying the css to my page, Scheduler control Headingsould conflit with my h2 property.
4. How can I solve this problem.