or
public class MyGenericFilter : GridBoundColumn
{
//RadGrid will call this method when it initializes the controls inside the filtering item cells
protected override void SetupFilterControls(TableCell cell)
{
base.SetupFilterControls(cell);
cell.Controls.RemoveAt(0);
RadComboBox combo = new RadComboBox();
combo.ID = ("RadComboBox1" + this.UniqueName);
combo.ShowToggleImage = false;
combo.Skin = "Office2007";
combo.EnableLoadOnDemand = true;
combo.AllowCustomText = true;
combo.AutoPostBack = true;
//combo.MarkFirstMatch = true;
combo.Height = Unit.Pixel(100);
combo.Width = Unit.Pixel(100);
combo.ItemsRequested += this.list_ItemsRequested;
combo.SelectedIndexChanged += this.list_SelectedIndexChanged;
combo.DropDownWidth = Unit.Pixel(150);
cell.Controls.AddAt(0, combo);
//cell.Controls.RemoveAt(1);
}
//RadGrid will cal this method when the value should be set to the filtering input control(s)
protected override void SetCurrentFilterValueToControl(TableCell cell)
{
base.SetCurrentFilterValueToControl(cell);
RadComboBox combo = (RadComboBox)cell.Controls[0];
if ((this.CurrentFilterValue != string.Empty))
{
combo.Text = this.CurrentFilterValue;
}
}
//RadGrid will cal this method when the filtering value should be extracted from the filtering input control(s)
protected override string GetCurrentFilterValueFromControl(TableCell cell)
{
RadComboBox combo = (RadComboBox)cell.Controls[0];
return combo.Text;
}
private void list_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
{
((RadComboBox)o).DataTextField = this.DataField;
((RadComboBox)o).DataValueField = this.DataField;
RadGrid MyGrid = ((RadGrid)((RadComboBox)o).Parent.Parent.Parent.Parent.Parent.Parent);
MyGrid.AllowPaging = false;
MyGrid.Rebind();
DataTable NewDT = new DataTable(this.DataField);
NewDT.Columns.Add(new DataColumn(this.DataField));
foreach (GridDataItem GD in MyGrid.Items)
{
if (GD[this.DataField].Text.Contains(e.Text) && GD[this.DataField].Text != " ")
{
var foundAuthors = NewDT.Select(this.DataField + " = '" + GD[this.DataField].Text + "'");
if (foundAuthors.Length == 0)
{
DataRow DR = NewDT.NewRow();
DR[this.DataField] = GD[this.DataField].Text;
NewDT.Rows.Add(DR);
}
}
}
MyGrid.AllowPaging = true;
MyGrid.Rebind();
NewDT.DefaultView.Sort = this.DataField + " ASC";
((RadComboBox)o).DataSource = NewDT;
((RadComboBox)o).DataBind();
}
private void list_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
{
GridFilteringItem filterItem = (GridFilteringItem)((RadComboBox)o).NamingContainer;
if ((this.UniqueName == "Index"))
{
//this is filtering for integer column type
filterItem.FireCommandEvent("Filter", new Pair("EqualTo", this.UniqueName));
}
//filtering for string column type
filterItem.FireCommandEvent("Filter", new Pair("Contains", this.UniqueName));
}
}
GridExcelExportFormat
.ExcelML format the excel opens and shows a message:
Problems During Load(see attached screenshot) .If I donot set the "UseAllDataFields" property of the MasterTableView,I do not get this message,but the excel is blank.Please help.
<script type=
"text/javascript"
>
function
pageLoad() {
var
pager = $find(
'<%=RadListView1.FindControl("RadDataPager1").ClientID %>'
).get_element();
$telerik.$(pager).find(
".rdpWrap a img"
)[0].src =
"PagingFirst.gif"
;
$telerik.$(pager).find(
".rdpWrap a img"
)[1].src =
"PagingPrev.gif"
;
$telerik.$(pager).find(
".rdpWrap a img"
)[2].src =
"PagingNext.gif"
;
$telerik.$(pager).find(
".rdpWrap a img"
)[3].src =
"PagingLast.gif"
;
}
</script>