protected void rcbYear_PreRender(object sender, EventArgs e)
{
RadComboBox combo = sender as RadComboBox;
if (ViewState[combo.ClientID] != null)
{
var rcbi = new RadComboBoxItem();
rcbi.Attributes.Add("0", "All");
combo.Items.Insert(0, rcbi);
combo.DataBind();
}
}
I verified that when the combo box comes in has the values from the store proc. The method runs normally but the combo ends with the same items as when it came in.
Any ideas?
<telerik:RadGrid ID="rgLabelManager" runat="server" Skin="ARC" AutoGenerateColumns="false"
GridLines="None" AllowSorting="true" AllowPaging="true" PageSize="10"
OnNeedDataSource="LabelManager_NeedDataSource" OnItemDataBound="LabelManager_ItemDataBound"
OnUpdateCommand="LabelManager_UpdateCommand" OnInsertCommand="LabelManager_InsertCommand">
<PagerStyle Mode="NextPrevAndNumeric" />
<MasterTableView Width="100%" AutoGenerateColumns="false" EditMode="InPlace"
CommandItemDisplay="TopAndBottom">
<Columns>
<telerik:GridTemplateColumn UniqueName="ContactName" SortExpression="LastName" HeaderText="Contact Name"
ItemStyle-Width="60%" ItemStyle-HorizontalAlign="Left">
<ItemTemplate> <%#((String)DataBinder.Eval(Container.DataItem, "FirstName")).Substring(0,1).ToUpper()%>
<%#((String)DataBinder.Eval(Container.DataItem, "FirstName")).Substring(1).ToLower()%>
<%#((String)DataBinder.Eval(Container.DataItem, "LastName")).Substring(0,1).ToUpper()%>
<%#((String)DataBinder.Eval(Container.DataItem, "LastName")).Substring(1).ToLower()%>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadComboBox ID="rcbContactName" runat="server" EnableVirtualScrolling="true"
ShowMoreResultsBox="true" ItemsPerRequest="10" EnableLoadOnDemand="true" Width="400"
OnClientItemsRequesting="GenericRadCombo_OnClientItemsRequesting"
OnClientItemsRequested="rcbLookupContact_OnClientItemsRequested"
OnClientDropDownClosing="rcbLookupContact_OnClientDropDownClosing">
<WebServiceSettings Method="LookupContact" Path="~/service/scriptservice.asmx" />
</telerik:RadComboBox>
<asp:LinkButton runat="server" ID="lbAdd" Text="Add New Contact" style="display:none;"
OnClick="lnkAddContact_Click"></asp:LinkButton>
</EditItemTemplate>
</telerik:GridTemplateColumn>
I want to access "lbAdd" from Javascript and keep getting error that lbAdd in not in the context. I've tried$find('<%=lbAdd.ClientID %>') anddocument.getElementById("<%=lbAdd.ClientID %>")
Please let me know if I'm missing something to access lbAdd - I need to change the display based on different conditions.
KTFrameworkCusEntities dcc = new KTFrameworkCusEntities();
IQueryable<
udv_Articles
> _udvResult;
public IEnumerable<
udv_Articles
> getAllArticleByCat(int catid)
{
//KTFrameworkCusEntities dc = new KTFrameworkCusEntities();
//_udvPro = null;
_udvResult = dcc.udv_Articles.Include("udv_Categories").Where(t => t.ArticleID == 99999999);
loadArticlebyCate(catid);
return _udvResult.OrderByDescending(t => t.UpdatedDate).ToList();
}
protected IQueryable<
udv_Articles
> loadArticlebyCate(int caid)
{
//KTFrameworkCusEntities dc = new KTFrameworkCusEntities();
Func<
KTFrameworkCusEntities
, IQueryable<udv_Articles>> _IEProList = CompiledQuery.Compile((KTFrameworkCusEntities ne) => ne.udv_Articles.Include("udv_Categories").Where(t => t.udv_Categories.CateID == caid));
if (_IEProList(dcc).Count() > 0)
{
_udvResult = _udvResult.Concat(_IEProList(dcc));
}
IEnumerable<
udv_Categories
> _IECatList = dcc.udv_Categories.Where(c => c.ParentID == caid);
if (_IECatList.Count() > 0)
{
foreach (var item in _IECatList)
{
loadArticlebyCate(item.CateID);
}
}
return _udvResult;
}
IQueryable<
udv_Categories
> _udvResult2;
public IEnumerable<
udv_Categories
> getAllCategoriesByCat(int catid)
{
//KTFrameworkCusEntities dc = new KTFrameworkCusEntities();
//_udvPro = null;
_udvResult2 = dcc.udv_Categories.Where(t => t.CateID == 99999999);
loadCategorybyCate(catid);
return _udvResult2.Where(t => t.IsActive == true).OrderBy(t => t.DisplayOrder).ToList();
}
protected IQueryable<
udv_Categories
> loadCategorybyCate(int caid)
{
//KTFrameworkCusEntities dc = new KTFrameworkCusEntities();
Func<
KTFrameworkCusEntities
, IQueryable<udv_Categories>> _IEProList = CompiledQuery.Compile((KTFrameworkCusEntities ne) => ne.udv_Categories.Where(t => t.ParentID == caid));
//IEnumerable<
udv_Categories
> _IEProList = dc.udv_Categories.Where(t => t.ParentID == caid);
//IEnumerable<
udv_Articles
> _IEProList = from c in dc.udv_Articles where c.udv_Categories.CateID == caid select c;
if (_IEProList(dcc).Count() > 0)
{
_udvResult2 = _udvResult2.Concat(_IEProList(dcc));
}
IEnumerable<
udv_Categories
> _IECatList = dcc.udv_Categories.Where(c => c.ParentID == caid);
if (_IECatList.Count() > 0)
{
foreach (var item in _IECatList)
{
loadCategorybyCate(item.CateID);
}
}
return _udvResult2;
}
<
telerik:RadGrid
ID
=
"RadGrid1"
AllowFilteringByColumn
=
"true"
PageSize
=
"20"
ShowFooter
=
"True"
AllowPaging
=
"True"
AutoGenerateColumns
=
"false"
GridLines
=
"None"
ShowStatusBar
=
"true"
runat
=
"server"
OnItemDataBound
=
"RadGrid1_ItemDataBound"
>
<
GroupingSettings
CaseSensitive
=
"false"
/>
<
MasterTableView
EditMode
=
"InPlace"
AllowFilteringByColumn
=
"True"
ShowFooter
=
"True"
DataKeyNames
=
"ArticleID"
TableLayout
=
"Fixed"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"Title"
HeaderText
=
"Tiêu đề"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
ShowFilterIcon
=
"false"
>
<
HeaderStyle
Width
=
"25%"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
DataField
=
"CateID"
HeaderText
=
"Danh mục"
UniqueName
=
"CateID"
HeaderStyle-Width
=
"200px"
SortExpression
=
"DisplayOrder"
>
<
FilterTemplate
>
<
telerik:RadComboBox
ID
=
"RadComboBoxCategories"
DataTextField
=
"Title"
DataValueField
=
"CateID"
Height
=
"100px"
AppendDataBoundItems
=
"true"
runat
=
"server"
>
<
Items
>
<
telerik:RadComboBoxItem
Text
=
"All"
/>
</
Items
>
</
telerik:RadComboBox
>
</
FilterTemplate
>
<
ItemTemplate
>
<%# Eval("udv_Categories.Title") %>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
if(!ispostback){
RadGrid1.DataSource = getAllArticleByCat(113);
RadGrid1.DataBind();
}
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridFilteringItem)
{
GridFilteringItem item = (GridFilteringItem)e.Item;
RadComboBox combo = (RadComboBox)item.FindControl("RadComboBoxCategories");
using (dmsFunction dmsf = new dmsFunction())
{
combo.DataSource = getCategoryByParent(113).ToList();
combo.DataBind();
combo.AutoPostBack = true;
combo.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(combo_SelectedIndexChanged);
}
}
}
void combo_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
// Custom Filter: Call getAllArticleByCat(Convert.ToInt32(combo.SelectedValue)) to get all Article by Categories
// Then RadGrid Filter
// Teach me how... Thanks
}
<
telerik:RadGrid
ID
=
"DataGrid"
runat
=
"server"
ShowStatusBar
=
"True"
AllowFilteringByColumn
=
"True"
AllowAutomaticUpdates
=
"false"
Width
=
"100%"
AllowAutomaticInserts
=
"false"
AllowAutomaticDeletes
=
"false"
AllowPaging
=
"True"
PageSize
=
"7"
ShowGroupPanel
=
"True"
>
<
MasterTableView
AutoGenerateColumns
=
"False"
AllowSorting
=
"true"
CommandItemDisplay
=
"Top"
AllowAutomaticUpdates
=
"false"
AllowAutomaticInserts
=
"false"
AllowAutomaticDeletes
=
"false"
HierarchyDefaultExpanded
=
"false"
HierarchyLoadMode
=
"Client"
DataKeyNames
=
"TaskID, ParentTaskID"
Width
=
"100%"
>
<
SelfHierarchySettings
ParentKeyName
=
"ParentTaskID"
KeyName
=
"TaskID"
/>
<
HeaderStyle
HorizontalAlign
=
"Center"
/><
FilterItemStyle
HorizontalAlign
=
"Center"
/>
<
NoRecordsTemplate
>No Records Found.</
NoRecordsTemplate
>
<
Columns
>
<
telerik:GridButtonColumn
UniqueName
=
"Edit"
CommandName
=
"Edit"
ButtonType
=
"ImageButton"
ImageUrl
=
"~/Styles/images/icon_edit.gif"
Text
=
"Edit"
HeaderText
=
"Edit"
>
<
HeaderStyle
Width
=
"35px"
HorizontalAlign
=
"center"
/>
</
telerik:GridButtonColumn
>
<
telerik:GridBoundColumn
DataField
=
"TaskID"
Visible
=
"True"
HeaderText
=
"TaskID"
ReadOnly
=
"True"
SortExpression
=
"TaskID"
UniqueName
=
"TaskID"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"TaskTitle"
HeaderText
=
"TaskTitle"
SortExpression
=
"TaskTitle"
UniqueName
=
"TaskTitle"
> </
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ParentTaskID"
HeaderText
=
"ParentTaskID"
SortExpression
=
"ParentTaskID"
Visible
=
"True"
UniqueName
=
"ParentTaskID"
> </
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
I'm using a client-side API to start the spell check process.
I'm using onchange client-side event to launch the SpellCheck dialog.
However, the SpellCheck dialog still appears & says "The spell check is complete!" even there are no misspelled words.
How can I suppress the SpellCheck dialog when there are no mispelled words ?
-JScript-
function MultipleTextSource(sources) {
this.sources = sources;
this.get_text = function () {
var texts = [];
for (var i = 0; i < this.sources.length; i++) {
texts[texts.length] = this.sources[i].get_text();
}
return texts.join("<controlSeparator><br/></controlSeparator>");
}
this.set_text = function (text) {
var texts = text.split("<controlSeparator><br/></controlSeparator>");
for (var i = 0; i < this.sources.length; i++) {
this.sources[i].set_text(texts[i]);
}
}
}
function spellCheck(obj, field) {
var sources =
[
new Telerik.Web.UI.Spell.HtmlElementTextSource($get(field))
];
var spell = GetRadSpell(obj);
spell.set_textSource(new MultipleTextSource(sources));
spell.startSpellCheck();
}
-ASPX-
<telerik:RadSpell ID="RadSpell1" runat="server" />
<asp:TextBox ID="TextBox1" runat="server" />
-Code Behind-
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
TextBox1.Attributes.Add("onchange", "spellCheck('" & RadSpell1.ClientID & "','" & TextBox1.ClientID & "')")
End Sub
I am using telerik grid internal sorting functionality.
I have set following properties -
AllowNaturalSort="false"
radGrid.MasterTableView.AllowSorting = true;
Issue -
If I click on header text of column, data get sorted but if I try to click on image for sorting, sorting is not working only page get postbacks.