| <asp:ScriptManager ID="ScriptManager" runat="server" /> |
| <radg:RadAjaxManager ID="AjaxManager" runat="server"> |
| <AjaxSettings> |
| <radg:AjaxSetting AjaxControlID="RadGrid1"> |
| <UpdatedControls> |
| <radg:AjaxUpdatedControl ControlID="RadGrid1" /> |
| </UpdatedControls> |
| </radg:AjaxSetting> |
| </AjaxSettings> |
| </radg:RadAjaxManager> |
| <radg:radgrid id="RadGrid1" runat="server" autogeneratecolumns="False" |
| allowsorting="True" allowfilteringbycolumn="True" width="1024px" |
| Height="800px" skin="Telerik" |
| onitemcommand="RadGrid1_ItemCommand" |
| onneeddatasource="RadGrid1_NeedDataSource"> |
| <MasterTableView AllowFilteringByColumn="True" /> |
| <PagerStyle Mode="NumericPages" /> |
| <ClientSettings> |
| <Scrolling AllowScroll="true" /> |
| </ClientSettings> |
| </radg:radgrid> |
| public class MyCustomFilteringColumn : GridBoundColumn |
| { |
| public MyCustomFilteringColumn() { } |
| public MyCustomFilteringColumn(string dataFieldName, string headerText) |
| { |
| this.DataField = dataFieldName; |
| this.HeaderText = headerText; |
| } |
| public static string connectionString |
| { |
| get |
| { |
| string dbPath = System.Web.HttpContext.Current.Server.MapPath("~\\Nwind.mdb"); |
| return ("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + dbPath); |
| } |
| } |
| protected override void SetupFilterControls(TableCell cell) |
| { |
| base.SetupFilterControls(cell); |
| cell.Controls.RemoveAt(0); |
| RadComboBox combo = new RadComboBox(); |
| combo.ID = ("RadComboBox1" + this.DataField); |
| combo.ShowToggleImage = false; |
| combo.Skin = "Telerik"; |
| combo.EnableLoadOnDemand = true; |
| combo.AutoPostBack = true; |
| combo.MarkFirstMatch = true; |
| combo.Height = Unit.Pixel(100); |
| combo.ItemsRequested += new RadComboBoxItemsRequestedEventHandler(this.list_ItemsRequested); |
| combo.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(this.list_SelectedIndexChanged); |
| cell.Controls.AddAt(0, combo); |
| List<ConfigurationInformation> infos = (List<ConfigurationInformation>)this.Owner.DataSource; |
| List<string> listsource = new List<string>(); |
| foreach (ConfigurationInformation info in infos) |
| { |
| if (this.DataField == "City") |
| listsource.Add(info.City); |
| else if (this.DataField == "CustomerName") |
| listsource.Add(info.CustomerName); |
| else if (this.DataField == "Country") |
| listsource.Add(info.Country); |
| else if (this.DataField == "OrderDate") |
| listsource.Add(info.OrderDate.ToString()); |
| } |
| combo.DataSource = listsource; |
| cell.Controls.RemoveAt(1); |
| } |
| protected override void SetCurrentFilterValueToControl(TableCell cell) |
| { |
| base.SetCurrentFilterValueToControl(cell); |
| RadComboBox combo = (RadComboBox)cell.Controls[0]; |
| if (this.CurrentFilterValue != string.Empty) |
| { |
| combo.Text = this.CurrentFilterValue; |
| } |
| } |
| protected override string GetCurrentFilterValueFromControl(TableCell cell) |
| { |
| RadComboBox combo = (RadComboBox)cell.Controls[0]; |
| return combo.Text; |
| } |
| private void list_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e) |
| { |
| (o as RadComboBox).DataTextField = this.DataField; |
| (o as RadComboBox).DataValueField = this.DataField; |
| if (((RadComboBox)o).DataTextField == "CustomerName") |
| { |
| List<ConfigurationInformation> test = (List<ConfigurationInformation>)this.Owner.DataSource; |
| (o as RadComboBox).DataSource = test.Distinct<ConfigurationInformation>(new CustomerNameComparer()); |
| /*this.Owner.DataSource*/ |
| } |
| else |
| (o as RadComboBox).DataSource = GetDataTable("SELECT DISTINCT " + this.UniqueName + " FROM Customers WHERE " + this.UniqueName + " LIKE '" + e.Text + "%'"); |
| (o as RadComboBox).DataBind(); |
| } |
| private void list_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) |
| { |
| GridFilteringItem filterItem = (GridFilteringItem)(o as RadComboBox).NamingContainer; |
| if (this.UniqueName == "Index") |
| { |
| filterItem.FireCommandEvent("Filter", new Pair("EqualTo", this.UniqueName)); |
| } |
| filterItem.FireCommandEvent("Filter", new Pair("Contains", this.UniqueName)); |
| } |
| public static DataTable GetDataTable(string query) |
| { |
| OleDbConnection MyOleDbConnection = new OleDbConnection(connectionString); |
| OleDbDataAdapter MyOleDbDataAdapter = new OleDbDataAdapter(); |
| MyOleDbDataAdapter.SelectCommand = new OleDbCommand(query, MyOleDbConnection); |
| DataTable myDataTable = new DataTable(); |
| MyOleDbConnection.Open(); |
| try |
| { |
| MyOleDbDataAdapter.Fill(myDataTable); |
| } |
| finally |
| { |
| MyOleDbConnection.Close(); |
| } |
| return myDataTable; |
| } |
| } |
| private List<ConfigurationInformation> Configs = new List<ConfigurationInformation>(); |
| public static string connectionString |
| { |
| get |
| { |
| string dbPath = System.Web.HttpContext.Current.Server.MapPath("~\\Nwind.mdb"); |
| return ("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + dbPath); |
| } |
| } |
| protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
| { |
| RadGrid1.DataSource = Configs; |
| //Configs.Distinct(new CustomerNameComparer()); |
| } |
| protected void Page_Load(object sender, System.EventArgs e) |
| { |
| if (!IsPostBack) |
| { |
| DataTable dt2 = GetDataTable("SELECT Customers.ContactName as CustomerName, Customers.City, Customers.Country, Orders.OrderDate FROM Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID where Index < 10;"); |
| foreach (DataRow row in dt2.Rows) |
| Configs.Add(new ConfigurationInformation( |
| (string)row["CustomerName"], (string)row["Country"], (string)row["City"], (DateTime)row["OrderDate"])); |
| //ds = GetDataSet("SELECT Country, City, Index FROM Customers"); |
| this.RadGrid1.MasterTableView.Columns.Clear(); |
| this.RadGrid1.MasterTableView.Columns.Add(new MyCustomFilteringColumn("CustomerName", "Customer Name")); |
| this.RadGrid1.MasterTableView.Columns.Add(new MyCustomFilteringColumn("City", "City")); |
| this.RadGrid1.MasterTableView.Columns.Add(new MyCustomFilteringColumn("Country", "Country")); |
| this.RadGrid1.MasterTableView.Columns.Add(new MyCustomFilteringColumn("OrderDate", "Order Date")); |
| } |
| } |
| //protected void RadGrid1_ColumnCreating(object sender, GridColumnCreatingEventArgs e) |
| //{ |
| // if (e.ColumnType == typeof(MyCustomFilteringColumn).Name) |
| // { |
| // e.Column = new MyCustomFilteringColumn(); |
| // } |
| //} |
| protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
| { |
| if (e.CommandName == "Filter") |
| { |
| foreach (GridColumn column in e.Item.OwnerTableView.Columns) |
| { |
| column.CurrentFilterValue = string.Empty; |
| column.CurrentFilterFunction = GridKnownFunction.NoFilter; |
| } |
| } |
| } |
| protected void clrFilters_Click(object sender, System.EventArgs e) |
| { |
| foreach (GridColumn column in RadGrid1.MasterTableView.Columns) |
| { |
| column.CurrentFilterFunction = GridKnownFunction.NoFilter; |
| column.CurrentFilterValue = string.Empty; |
| } |
| RadGrid1.MasterTableView.FilterExpression = string.Empty; |
| RadGrid1.MasterTableView.Rebind(); |
| } |
| public static DataTable GetDataTable(string query) |
| { |
| OleDbConnection MyOleDbConnection = new OleDbConnection(connectionString); |
| OleDbDataAdapter MyOleDbDataAdapter = new OleDbDataAdapter(); |
| MyOleDbDataAdapter.SelectCommand = new OleDbCommand(query, MyOleDbConnection); |
| DataTable myDataTable = new DataTable(); |
| MyOleDbConnection.Open(); |
| try |
| { |
| MyOleDbDataAdapter.Fill(myDataTable); |
| } |
| finally |
| { |
| MyOleDbConnection.Close(); |
| } |
| return myDataTable; |
| } |
| //public static DataSet GetDataSet(string query) |
| //{ |
| // OleDbConnection MyOleDbConnection = new OleDbConnection(connectionString); |
| // OleDbDataAdapter MyOleDbDataAdapter = new OleDbDataAdapter(); |
| // MyOleDbDataAdapter.SelectCommand = new OleDbCommand(query, MyOleDbConnection); |
| // DataSet myDataSet = new DataSet("Customers"); |
| // MyOleDbConnection.Open(); |
| // try |
| // { |
| // MyOleDbDataAdapter.Fill(myDataSet); |
| // } |
| // finally |
| // { |
| // MyOleDbConnection.Close(); |
| // } |
| // return myDataSet; |
| //} |
| } |
When attempting to use the slider control with paging the code gets an invalid object error at the following point:
if(this._showDragHandle){
if(_64){
_63.style.left=_6e.x+"px";
}else{
_63.style.top=_6e.y+"px";
}
<telerik:RadTabStrip ID="radtabstpPatientView" SelectedIndex="0" runat="server" MultiPageID="radmltpgPatientView"
Skin="CustomTabStripSkin" CssClass="clsLabel" EnableEmbeddedSkins="false" >
<Tabs>
<telerik:RadTab Text="Patient Chronology" PageViewID="PatChronology">
</telerik:RadTab>
</Tabs>
<Tabs>
<telerik:RadTab Text="Balance Summary" PageViewID="BalSummary">
</telerik:RadTab>
</Tabs>
<Tabs>
<telerik:RadTab Text="Unapplied Payment Details" PageViewID="UnappliedPayDet">
</telerik:RadTab>
</Tabs>
</telerik:RadTabStrip>
<telerik:RadMultiPage ID="radmltpgPatientView" runat="server" SelectedIndex="0" CssClass="clsLabel">
<telerik:RadPageView ID="radpgviewPatChronology" runat="server">
<table border="0" cellpadding="2" cellspacing="2" width="100%">
<tr>
<td>
<telerik:RadGrid ID="RadGrid1" Skin="Office2007" runat="server" Width="95%" AutoGenerateColumns="False"
PageSize="7" AllowSorting="True" AllowPaging="True" GridLines="None" ShowStatusBar="true" AllowMultiRowSelection="true" >
<PagerStyle Mode="NumericPages"></PagerStyle>
<MasterTableView AllowMultiColumnSorting="True" DataKeyNames="dt1Id,Type" Width="100%" EnableNoRecordsTemplate="false" >
<Columns>
<telerik:GridBoundColumn SortExpression="dt1Id" HeaderText="DTID" HeaderButtonType="TextButton"
DataField="dt1Id" Resizable="True" Reorderable="True" Display="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="Type" HeaderText="Type" HeaderButtonType="TextButton"
DataField="Type" Resizable="True" Reorderable="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="Date" HeaderText="Date" HeaderButtonType="TextButton"
DataField="Date" Resizable="True" Reorderable="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="Description" HeaderText="Description" HeaderButtonType="TextButton"
DataField="Description" Resizable="True" Reorderable="True">
</telerik:GridBoundColumn>
</Columns>
<DetailTables >
<telerik:GridTableView Caption="" AllowSorting="false" DataKeyNames="dt1Id" Width="100%" ShowHeader="false" EnableNoRecordsTemplate="false">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="dt1Id" MasterKeyField="dt1Id" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn HeaderText="dt1Id" HeaderButtonType="TextButton"
DataField="dt1Id" Display="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Type" HeaderButtonType="TextButton"
DataField="Type">
<ItemStyle Width="207px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Date" HeaderButtonType="TextButton"
DataField="Date">
<ItemStyle Width="67px" />
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="">
<ItemTemplate>
<asp:ImageButton id="imgbtn" imageurl="~/Images/btn_Edit.gif" runat="server" visible= <%# DataBinder.Eval(Container.DataItem, "Status")%>>
</asp:ImageButton>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn HeaderText="Description" HeaderButtonType="TextButton"
DataField="Description">
</telerik:GridBoundColumn>
</Columns>
<DetailTables>
<telerik:GridTableView Caption="" AllowSorting="false" DataKeyNames="dt1Id" Width="100%" ShowHeader="false" EnableNoRecordsTemplate="false" >
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="dt1Id" MasterKeyField="dt1Id" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn HeaderText="dt1Id" HeaderButtonType="TextButton"
DataField="dt1Id" Display="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Type" HeaderButtonType="TextButton"
DataField="Type">
<ItemStyle Width="207px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Date" HeaderButtonType="TextButton"
DataField="Date">
<ItemStyle Width="67px" />
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="">
<ItemTemplate>
<asp:ImageButton id="imgbtn" imageurl="~/Images/btn_Edit.gif" runat="server" visible= <%# DataBinder.Eval(Container.DataItem, "Status")%>>
</asp:ImageButton>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn HeaderText="Description" HeaderButtonType="TextButton"
DataField="Description">
</telerik:GridBoundColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
</telerik:GridTableView>
</DetailTables>
</MasterTableView>
<ClientSettings>
<Selecting AllowRowSelect="true" />
</ClientSettings>
</telerik:RadGrid>
This is the way iam setting and bindiing the datasoruce for the grid
RadGrid1.MasterTableView.DataSource = dtTable1
RadGrid1.MasterTableView.DetailTables(0).DataSource = dtTable2
RadGrid1.MasterTableView.DetailTables(0).DetailTables(0).DataSource = dtTable3
RadGrid1.DataBind()
The table structures are as below
dtTable1.Columns.Add(
"dt1Id")
dtTable1.Columns.Add(
"Type")
dtTable1.Columns.Add(
"Date")
dtTable1.Columns.Add(
"EmptyColumn")
dtTable1.Columns.Add(
"Description")
dtTable1.Columns.Add(
"Status")
dtTable2.Columns.Add(
"dt1Id")
dtTable2.Columns.Add(
"Type")
dtTable2.Columns.Add(
"Date")
dtTable2.Columns.Add(
"EmptyColumn")
dtTable2.Columns.Add(
"Description")
dtTable2.Columns.Add(
"Status")
dtTable3.Columns.Add(
"dt1Id")
dtTable3.Columns.Add(
"Type")
dtTable3.Columns.Add(
"Date")
dtTable3.Columns.Add(
"EmptyColumn")
dtTable3.Columns.Add(
"Description")
dtTable3.Columns.Add(
"Status")
Regards,
Santhosh