or
<
asp:DropDownList
ID
=
"DropDownList1"
runat
=
"server"
>
</
asp:DropDownList
>
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
>
</
telerik:RadComboBox
>
Protected
Sub
Page_Load(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Me
.Load
If
Not
IsPostBack
Then
For
i
As
Integer
= 0
To
200
Dim
itm
As
New
ListItem()
itm.Value = i
itm.Text = i
DropDownList1.Items.Add(itm)
Next
For
i
As
Integer
= 0
To
200
Dim
rcbItem
As
New
RadComboBoxItem()
rcbItem.Value = i
rcbItem.Text = i
RadComboBox1.Items.Add(rcbItem)
rcbItem.DataBind()
Next
End
If
End
Sub
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"CenterContentPlaceHolder"
runat
=
"Server"
>
<
telerik:RadGrid
ID
=
"GridEvent"
runat
=
"server"
AutoGenerateColumns
=
"False"
ShowHeader
=
"False"
GridLines
=
"None"
ShowGroupFooter
=
"true"
OnItemDataBound
=
"RadGrid1_ItemDataBound"
OnItemCreated
=
"RadGrid1_ItemCreated"
OnPreRender
=
"RadGrid1_PreRender"
OnInsertCommand
=
"RadGrid1_InsertCommand"
OnCancelCommand
=
"RadGrid1_CancelCommand"
OnEditCommand
=
"RadGrid1_EditCommand"
OnUpdateCommand
=
"RadGrid1_UpdateCommand"
AllowAutomaticDeletes
=
"False"
AllowAutomaticInserts
=
"False"
AllowAutomaticUpdates
=
"False"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
>
<
ClientSettings
AllowDragToGroup
=
"False"
>
</
ClientSettings
>
<
MasterTableView
AutoGenerateColumns
=
"False"
GroupLoadMode
=
"Client"
InsertItemDisplay
=
"Top"
CellPadding
=
"0"
CellSpacing
=
"0"
EditMode
=
"EditForms"
DataKeyNames
=
"Id,LogDate"
>
<
Columns
>
<
telerik:GridTemplateColumn
EditFormHeaderTextFormat
=
"{0}"
UniqueName
=
"TemplateColumnUniqueName"
>
<
EditItemTemplate
>
<
telerik:RadEditor
ID
=
"RadEditorEventLog"
runat
=
"server"
ToolsFile
=
"~/ExtraSimpleToolsFile.xml"
Width
=
"100%"
DialogHandlerUrl
=
'~/Telerik.Web.UI.DialogHandler.axd'
EditModes
=
"Design"
Height
=
"200px"
Content='<%# Bind("Description") %>'>
</
telerik:RadEditor
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
div
class
=
"cell"
>
<
asp:Label
ID
=
"lblDescription"
runat
=
"server"
Text='<%#DataBinder.Eval(Container.DataItem,"Description") %>'></
asp:Label
>
</
div
>
<
div
class
=
"right-justify top"
>
<
asp:Button
ID
=
"btnAlter"
runat
=
"server"
Text
=
"Alter*"
CommandName
=
"Edit"
/>
</
div
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
<
EditFormSettings
EditFormType
=
"AutoGenerated"
>
<
FormMainTableStyle
CellSpacing
=
"0"
CellPadding
=
"0"
Width
=
"100%"
/>
<
FormTableStyle
CellSpacing
=
"0"
CellPadding
=
"0"
BackColor
=
"White"
/>
<
EditColumn
ButtonType
=
"PushButton"
InsertText
=
"Save*"
UpdateText
=
"Save**"
UniqueName
=
"EditCommandColumn1"
CancelText
=
"Cancel*"
>
</
EditColumn
>
</
EditFormSettings
>
<
GroupByExpressions
>
<
telerik:GridGroupByExpression
>
<
GroupByFields
>
<
telerik:GridGroupByField
FieldName
=
"LogDate"
SortOrder
=
"Descending"
/>
</
GroupByFields
>
<
SelectFields
>
<
telerik:GridGroupByField
FieldName
=
"LogDate"
/>
</
SelectFields
>
<
SelectFields
>
<
telerik:GridGroupByField
FieldName
=
"UserFullName"
/>
</
SelectFields
>
</
telerik:GridGroupByExpression
>
</
GroupByExpressions
>
<
SortExpressions
>
<
telerik:GridSortExpression
FieldName
=
"LogDate"
SortOrder
=
"Descending"
/>
</
SortExpressions
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
telerik:RadAjaxManager
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"GridEvent"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"GridEvent"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
/>
</
asp:Content
>
protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)
{
if ((e.Item is GridEditFormInsertItem) && (e.Item.OwnerTableView.IsItemInserted))
{
RadEditor editor = (RadEditor)e.Item.FindControl("RadEditorEventLog");
if (editor != null)
{
if (editor.Text.Trim().Length <
1
)
{
return;
}
else
{
IPurchase
purchase
=
Factory
.Get<IPurchase>((int)this.Object.ObjectId);
purchase.AddEventLog(true, editor.Content);
LoadEventLog();
this.GridEvent.Rebind();
}
}
}
}
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
this
.GridEvent.MasterTableView.IsItemInserted = true ;
this.GridEvent.Rebind();
}
....
<
telerik:GridTemplateColumn
UniqueName
=
"Unit.Name"
HeaderText
=
"Unit"
DataField
=
"Unit.Id"
SortExpression
=
"Unit.Id"
ItemStyle-Width
=
"250px"
>
<
ItemTemplate
>
<%# DataBinder.Eval(Container.DataItem, "Unit.Name")%>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadComboBox
runat
=
"server"
ID
=
"UnitComboBox"
EnableLoadOnDemand
=
"True"
SelectedValue='<%#Bind("Unit.Id")%>'
DataTextField="Name" DataSourceID="UnitEntityDataSource"
DataValueField="Id" AutoPostBack="true" HighlightTemplatedItems="true" Height="250px" Width="250px" DropDownWidth="600px">
....
RadMenu1.DataSource = dt;
RadMenu1.DataFieldID =
"ID";
RadMenu1.DataFieldParentID =
"Parent_ID";
RadMenu1.DataTextField =
"Text";
RadMenu1.DataNavigateUrlField =
"URL";
RadMenu1.DataBind();
and it works fine....
i have two questions:-
1- I need to use templates in this menu to add items as hyperlinks for example... Is there any way to add the itemtemplate at run time?
2- How can i bind a radmenu to sitmap that is also bounded at run time(by code) as the above example?
i will appreciate any help...
Thanks....