Hi,
I have a grid with the definition below, DataSource is set to a DataTable in NeedDataSoruce & the grid shows up fine. When Dragging a column to the group area or selecting a filter then the grid disappears, what could be the problem?
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
Height
=
"99%"
OnNeedDataSource
=
"RadGrid1_NeedDataSource1"
CssClass
=
"startInvisible"
AllowFilteringByColumn
=
"True"
AllowPaging
=
"True"
AllowSorting
=
"True"
GroupPanelPosition
=
"Top"
ShowGroupPanel
=
"True"
AllowMultiRowSelection
=
"True"
OnColumnCreated
=
"RadGrid1_ColumnCreated"
OnPreRender
=
"RadGrid1_PreRender"
>
<
ClientSettings
AllowDragToGroup
=
"True"
>
<
Selecting
AllowRowSelect
=
"True"
/>
<
Scrolling
AllowScroll
=
"True"
UseStaticHeaders
=
"True"
/>
<
Resizing
AllowColumnResize
=
"True"
AllowResizeToFit
=
"True"
ResizeGridOnColumnResize
=
"true"
/>
<
ClientEvents
OnGridCreated
=
"GridCreated"
/>
</
ClientSettings
>
<
MasterTableView
>
<
RowIndicatorColumn
Visible
=
"False"
>
</
RowIndicatorColumn
>
<
Columns
>
<
telerik:GridClientSelectColumn
FilterControlAltText
=
"Filter ClientSelectColumn column"
UniqueName
=
"ClientSelectColumn"
>
</
telerik:GridClientSelectColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
Hi,
I have bound data to a radgrid using the needdatasource method to display a set of details that I want. It works fine and I was able to remove the filter icon from each column and set the current filter function to contains as well.
Now, I want to be able to filter the details that I am seeing, but even though the options are set in the radgrid definition I can not filter or group my data. The events do not fire or cause any change.
What have I missed or done wrong? Please help.
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="time-and-action-ganttchart-details.aspx.cs" Inherits="time_and_action_ganttchart_details" %>
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"head"
runat
=
"Server"
>
<
title
>Genesis | Time And Action</
title
>
</
asp:Content
>
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"headstyles"
runat
=
"Server"
>
</
asp:Content
>
<
asp:Content
ID
=
"Content3"
ContentPlaceHolderID
=
"pagehead"
runat
=
"Server"
>
<
h1
>Time And Action <
small
>time and action plan</
small
></
h1
>
</
asp:Content
>
<
asp:Content
ID
=
"Content4"
ContentPlaceHolderID
=
"body"
runat
=
"Server"
>
<!-- BEGIN PAGE BREADCRUMB -->
<
ul
class
=
"page-breadcrumb breadcrumb"
>
<
li
>
<
a
href
=
"#"
>Home</
a
><
i
class
=
"fa fa-circle"
></
i
>
</
li
>
<
li
class
=
"active"
>time and action plan
</
li
>
</
ul
>
<!-- END PAGE BREADCRUMB -->
<!-- BEGIN PAGE CONTENT INNER -->
<
div
class
=
"row"
>
<
div
class
=
"col-md-12"
>
<!-- BEGIN SAMPLE FORM PORTLET-->
<
div
class
=
"portlet light "
>
<
div
class
=
"portlet-title"
>
<
div
class
=
"caption caption-md"
>
<
i
class
=
"icon-bar-chart theme-font-color hide"
></
i
>
<
span
class
=
"caption-subject theme-font-color bold uppercase"
>Time And Action Plan</
span
>
</
div
>
<
div
class
=
"actions"
>
<
a
class
=
"btn btn-circle btn-icon-only btn-default fullscreen"
href
=
"javascript:;"
></
a
>
</
div
>
</
div
>
<
div
class
=
"portlet-body"
>
<
div
class
=
"table-responsive"
>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
></
asp:ScriptManager
>
<
asp:ImageButton
ID
=
"ImageButton1"
runat
=
"server"
OnClick
=
"ImageButton1_Click"
ImageUrl
=
"~/images/Office-Excel-icon.png"
Width
=
"4%"
Height
=
"4%"
ToolTip
=
"Export to Excel"
/>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
AllowSorting
=
"True"
AllowPaging
=
"True"
ShowGroupPanel
=
"True"
GroupingSettings-CaseSensitive
=
"false"
AllowFilteringByColumn
=
"True"
CellSpacing
=
"-1"
GridLines
=
"Both"
Skin
=
"Metro"
CssClass
=
"rad_header_style"
Width
=
"100%"
OnColumnCreated
=
"RadGrid1_ColumnCreated"
OnDataBound
=
"RadGrid1_DataBound"
>
</
telerik:RadGrid
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
<!-- END PAGE CONTENT -->
</
asp:Content
>
<
asp:Content
ID
=
"Content5"
ContentPlaceHolderID
=
"footer"
runat
=
"Server"
>
<!-- BEGIN PAGE LEVEL PLUGINS -->
<
script
type
=
"text/javascript"
src
=
"../../assets/global/plugins/fancybox/source/jquery.fancybox.pack.js"
></
script
>
<
script
src
=
"../../assets/global/scripts/metronic.js"
type
=
"text/javascript"
></
script
>
<
script
src
=
"../../assets/admin/layout4/scripts/layout.js"
type
=
"text/javascript"
></
script
>
<
script
src
=
"../../assets/admin/layout4/scripts/demo.js"
type
=
"text/javascript"
></
script
>
<
script
>
jQuery(document).ready(function () {
Metronic.init(); // init metronic core components
Layout.init(); // init current layout
Demo.init(); // init demo features
});
</
script
>
<!-- END PAGE LEVEL PLUGINS -->
</
asp:Content
>
using System;
using System.Data;
using System.Linq;
using Telerik.Web.UI;
public partial class time_and_action_ganttchart_details : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
short techpackID = 93; // short.Parse(Request.QueryString[0]);
DataTable dt = new DataTable();
dt.Columns.Add("Customer", typeof(string));
dt.Columns.Add("Account", typeof(string));
dt.Columns.Add("Season", typeof(string));
dt.Columns.Add("Program", typeof(string));
dt.Columns.Add("Tech Pack Name", typeof(string));
dt.Columns.Add("Design Ref", typeof(string));
dt.Columns.Add("Stroke", typeof(string));
dt.Columns.Add("Type", typeof(string));
dt.Columns.Add("Assortment Name", typeof(string));
dt.Columns.Add("Component", typeof(string));
dt.Columns.Add("RM Description", typeof(string));
dt.Columns.Add("Supplier", typeof(string));
dt.Columns.Add("CSP", typeof(string));
dt.Columns.Add("Mode", typeof(string));
dt.Columns.Add("RM Color Code", typeof(string));
dt.Columns.Add("RM Color Name", typeof(string));
dt.Columns.Add("Silhoutte", typeof(string));
dt.Columns.Add("Garment Number", typeof(string));
using (PDLC.Data.PDLCEntities context = new PDLC.Data.PDLCEntities())
{
var version = context.V_TimeAndAction_TechPackLeadTime.Where(x => x.TP_ID == techpackID).Select(s => new { s.VersionID }).Max(p => p.VersionID);
var distinctEvents = context.V_TimeAndAction_TechPackLeadTime.Where(x => x.TP_ID == techpackID && x.VersionID == version).Select(s => new { s.EventText, s.EventOrder }).Distinct().OrderBy(o => o.EventOrder);
foreach (var eventname in distinctEvents)
{
dt.Columns.Add(eventname.EventText, typeof(string));
dt.Columns.Add("Actual " + eventname.EventText, typeof(string));
dt.Columns.Add("Committed " + eventname.EventText, typeof(string));
}
var assortmentIdList = context.V_TimeAndAction_TechPackLeadTime.Where(x => x.TP_ID == techpackID && x.VersionID == version).Select(s => new { s.AS_ID }).Distinct();
foreach (var assortmentId in assortmentIdList)
{
var rawMaterialList = context.V_TimeAndAction_TechPackLeadTime.Where(x => x.TP_ID == techpackID && x.VersionID == version && x.AS_ID == assortmentId.AS_ID).Select(s => new { s.RawMaterialID }).OrderBy(o => o.RawMaterialID).Distinct();
foreach (var rawmaterial in rawMaterialList)
{
DataRow dr = dt.NewRow();
var headerDetails = context.V_TimeAndAction_TechPackLeadTime.Where(x => x.TP_ID == techpackID && x.VersionID == version && x.AS_ID == assortmentId.AS_ID && x.RawMaterialID == rawmaterial.RawMaterialID).Select(s => new
{
s.Cust_Name,
s.Account_Name,
s.Season_Name,
s.ProgramName,
s.Design_Ref,
s.Stroke,
s.StyleTypeName,
s.Component_Name,
s.Description60Digit,
s.sales_office_name,
s.Color_Code,
s.Color_Name,
s.ShapeName,
s.GMT_ID,
s.TP_Name,
s.Assortment_name
}).Distinct().First();
dr["Customer"] = headerDetails.Cust_Name;
dr["Account"] = headerDetails.Account_Name;
dr["Season"] = headerDetails.Season_Name;
dr["Program"] = headerDetails.ProgramName;
dr["Tech Pack Name"] = headerDetails.TP_Name;
dr["Design Ref"] = headerDetails.Design_Ref;
dr["Stroke"] = headerDetails.Stroke;
dr["Type"] = headerDetails.StyleTypeName;
dr["Assortment Name"] = headerDetails.Assortment_name;
dr["Component"] = headerDetails.Component_Name;
dr["RM Description"] = headerDetails.Description60Digit;
dr["Supplier"] = headerDetails.sales_office_name;
dr["CSP"] = "CSP";
dr["Mode"] = "Mode";
dr["RM Color Code"] = headerDetails.Color_Code;
dr["RM Color Name"] = headerDetails.Color_Name;
dr["Silhoutte"] = headerDetails.ShapeName;
dr["Garment Number"] = headerDetails.GMT_ID;
var eventIdList = context.V_TimeAndAction_TechPackLeadTime.Where(x => x.TP_ID == techpackID && x.VersionID == version && x.AS_ID == assortmentId.AS_ID && x.RawMaterialID == rawmaterial.RawMaterialID).Select(s => new { s.EventID, s.EventOrder, s.EventText }).Distinct().OrderBy(o => o.EventOrder);
foreach (var eventId in eventIdList)
{
var timeandactiondates = context.V_TimeAndAction_TechPackLeadTime.Where(x => x.TP_ID == techpackID && x.VersionID == version && x.AS_ID == assortmentId.AS_ID && x.RawMaterialID == rawmaterial.RawMaterialID && x.EventID == eventId.EventID).Select(s => new { s.TimeAndActionES, s.ActualDate, s.CommittedDate }).Distinct().FirstOrDefault();
DateTime timeandactiones = (DateTime)timeandactiondates.TimeAndActionES;
dr[eventId.EventText] = timeandactiones.ToShortDateString();
if (timeandactiondates.ActualDate != null)
{
DateTime timeandactionactual = (DateTime)timeandactiondates.ActualDate;
dr["Actual " + eventId.EventText] = timeandactionactual.ToShortDateString();
}
else
{
dr["Actual " + eventId.EventText] = timeandactiondates.ActualDate;
}
if (timeandactiondates.CommittedDate != null)
{
DateTime timeandactualcommitted = (DateTime)timeandactiondates.CommittedDate;
dr["Committed " + eventId.EventText] = timeandactualcommitted.ToShortDateString();
}
else
{
dr["Committed " + eventId.EventText] = timeandactiondates.CommittedDate;
}
}
dt.Rows.Add(dr);
}
}
}
RadGrid1.DataSource = dt;
}
protected void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
RadGrid1.Rebind();
RadGrid1.ExportSettings.ExportOnlyData = true;
RadGrid1.ExportSettings.IgnorePaging = true;
RadGrid1.ExportSettings.OpenInNewWindow = true;
RadGrid1.ExportSettings.UseItemStyles = true;
RadGrid1.ExportSettings.Excel.Format = GridExcelExportFormat.Xlsx;
RadGrid1.ExportSettings.FileName = "T-and-A " + DateTime.Today.ToString("yyyy-MM-dd");
RadGrid1.MasterTableView.ExportToExcel();
}
protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
{
e.Column.ShowFilterIcon = false;
}
protected void RadGrid1_DataBound(object sender, EventArgs e)
{
foreach (GridColumn column in RadGrid1.MasterTableView.AutoGeneratedColumns)
{
column.AutoPostBackOnFilter = true;
column.CurrentFilterFunction = GridKnownFunction.Contains;
column.ShowFilterIcon = false;
}
}
}
Thanks in advance. :)
I have a Scheduler bound to an ObjectDataSource that I want to filter using a dropdown list of Categories. I have a ControlParameter as a SelectParameter on the ObjectDataSource tied to this dropdown. My filtering works fine if I select an Category that has appointments associated with it and actually returns rows. However, if I select a Category that does not have any appointments associated with it and returns no rows, the Scheduler never updates and continues to show the previous list of appointments instead of showing no appointments. Any idea on why the Scheduler won't refresh and properly show no appointments in this situation?
I am working on my own styling of this control because I want it displayed in a small form center of the screen.
Formatting the "select" button is a little limited and therefore I want to have my own button outside of the actual control itself to fire the selection of files.
The idea is that when my button is clicked it triggers the RadAsyncUpload control to fire up a dialog to select files using the File Explorer.
I can't see a method that I can call on the client side for this.
Is this even possible?
I have tried styling the button with an image but it is irratic, the div doesnt extend to show the larger image and it all looks a mess.
If I localise the value to something longer than the word "select" then it flows outside the standard button.
can anyone offer a suggest as to how to either trigger the selection of files from my own button or substantially style the RAD button to something larger and perhaps image based?
thanks
jON
Hello All,
I'm having problems accessing a value in the OnNeedDataSource event. The value is a textbox in the CommandItemTemplate. I'm using it as a custom filter while building the datasource. I've done this before but forgot how I did it. :( It seems that during the OnNeedDataSource the CommandItemTemplate has not been created yet.
Thanks,
Jerry
Hello,
<
telerik:RadTreeView
ID
=
"ModuleFiles"
Skin
=
"Web20"
MultipleSelect
=
"True"
EnableDragAndDrop
=
"True"
EnableDragAndDropBetweenNodes
=
"false"
runat
=
"server"
AllowNodeEditing
=
"true"
OnNodeClick="trvModuleFiles_NodeClick" OnNodeEdit="trvModuleFiles_NodeEdit"
OnClientNodeClicking="ClientNodeClicked" OnClientNodeEditStart="ClientTreeNodeEditStart" OnClientNodeEditing="ClientTreeNodeEditing">
after node editing when i click on other node (of same treeview node) OnNodeEdit does not fired
i need both the events
OnNodeClick i have saved node information.
how i can solved this problem.
Hi,
I'm quite new with asp and telerik components, so I need some help to figure this out:
i'm trying to validate GridDropDownColumns that hold Combobox's and check is text area of combobox filled with value from dropdown.
Now my problem is when I try to add custom validator in cs code side, it doesn't fire serverside validation. I don't want to add templatecollums to my grid if it's not necessary.
in itemDataBound:
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem item = e.Item as GridEditableItem;
if(item["content"].Controls[0] is RadComboBox)
{
GridDropDownListColumnEditor editor = item.EditManager.GetColumnEditor("content") as GridDropDownListColumnEditor;
TableCell cell = (TableCell)editor.ComboBoxControl.Parent;
CustomValidator validator = new CustomValidator();
validator.ServerValidate += new ServerValidateEventHandler(comboboxValidations_ServerValidate);
validator.ValidationGroup = "comboGroup";
validator.ErrorMessage = "!";
validator.ValidateEmptyText = true;
validator.ControlToValidate = editor.ComboBoxControl.ID;
cell.Controls.Add(validator);
}
}
Hi
I have a RadGgrid witht he following template section:
<telerik:GridTemplateColumn HeaderText="Arrival" SortExpression="LocationArrival" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" AllowFiltering="false" UniqueName="LocationArrival">
<ItemTemplate>
<asp:CheckBox ID="chkActivityArrival" runat="server" AutoPostBack="True" visible="false" OnCheckedChanged="chkActivityArrival_CheckedChanged"/>
</ItemTemplate>
</telerik:GridTemplateColumn>
However when I click the checkbox the function chkActivityArrival_CheckedChanged on the server isn't being hit. The controls visibility is controlled in the code behind.
I have the same code n other grids and they work OK, what would be causing this..
Andy
<
telerik:RadGrid
ID
=
"radGrid1"
runat
=
"server"
AutoGenerateColumns
=
"False"
GridLines
=
"None"
AllowMultiRowEdit
=
"True"
OnItemDataBound
=
"radGrid1_ItemDataBound"
OnNeedDataSource
=
"radGrid1_NeedDataSource"
>
<
MasterTableView
AutoGenerateColumns
=
"false"
EditMode
=
"InPlace"
ShowFooter
=
"false"
CommandItemDisplay
=
"Top"
OnPreRender
=
"radGrid1_PreRender"
>
<
Columns
>
<
telerik:GridTemplateColumn
HeaderText
=
"Product Name"
UniqueName
=
"Product_Name"
>
<
ItemTemplate
>
<
asp:DropDownList
ID
=
"ddl1"
runat
=
"server"
AutoPostBack
=
"true"
DataTextField
=
"product_Name"
DataValueField
=
"product_Name"
OnSelectedIndexChanged
=
"ddl1_SelectedIndexChanged"
>
</
asp:DropDownList
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Product_rate"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblrate"
runat
=
"server"
></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Product Quantity"
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"txtQuantity"
runat
=
"server"
/>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Product Amount"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblAmount"
runat
=
"server"
/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
protected
void
ddl1_SelectedIndexChanged(
object
sender, EventArgs e)
{
DropDownList list = (DropDownList)sender;
GridDataItem item = (GridDataItem)list.NamingContainer;
//display selected value of dropdown list.
//string str = list.SelectedValue;
//(item.FindControl("lblRate") as Label).Text = str;
SqlConnection con =
new
SqlConnection(ConfigurationManager.ConnectionStrings[
"chalk_hillConnectionString"
].ConnectionString);
con.Open();
SqlCommand cmd =
new
SqlCommand(
"select product_rate from product_detail where product_name='"
+ list.SelectedItem.Text +
"'"
, con);
SqlDataReader reader; ;
reader = cmd.ExecuteReader();
if
(reader.Read())
{
(item.FindControl(
"lblRate"
)
as
Label).Text = reader[
"product_rate"
].ToString();
}
}
protected
void
radGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
DropDownList list = (DropDownList)item.FindControl(
"ddl1"
);
list.Items.Insert(0,
new
ListItem(
"select"
,
"-1"
));
SqlConnection con =
new
SqlConnection(ConfigurationManager.ConnectionStrings[
"chalk_hillConnectionString"
].ConnectionString);
SqlDataAdapter da =
new
SqlDataAdapter();
da.SelectCommand =
new
SqlCommand(
"select product_name from product_detail"
, con);
DataSet ds =
new
DataSet();
da.Fill(ds);
list.DataSource = ds;
list.DataBind();
}
}