If I change the bundColumn to GridBoundColumn, then no error . Please help!!
-----------------
below is my code:
protected void Page_Load(object sender, EventArgs e)
{
GridHTMLEditorColumn boundColumn = new GridHTMLEditorColumn();
boundColumn.DataField =
"French";
boundColumn.HeaderText =
"French";
boundColumn.UniqueName =
"French";
this.RadGrid1.MasterTableView.Columns.Add(boundColumn);
}
protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
//bind grid to db
DataSet ds;
ds = SqlHelper.ExecuteDataset(ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString, "sp_Languages_Get");
RadGrid1.DataSource = ds;
}
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head runat="server">
<title></title>
</
head>
<
body>
<form id="form1" runat="server">
<div>
<telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
</telerik:RadScriptManager>
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False"
GridLines="None" onneeddatasource="RadGrid1_NeedDataSource">
<
MasterTableView autogeneratecolumns="True">
<
RowIndicatorColumn>
<
HeaderStyle Width="20px"></HeaderStyle>
</
RowIndicatorColumn>
<
ExpandCollapseColumn>
<
HeaderStyle Width="20px"></HeaderStyle>
</
ExpandCollapseColumn>
<Columns>
<telerik:GridEditCommandColumn>
</telerik:GridEditCommandColumn>
<telerik:GridButtonColumn CommandName="Delete" Text="Delete"
UniqueName="column">
</telerik:GridButtonColumn>
</Columns>
</
MasterTableView>
</telerik:RadGrid>
</div>
</form>
</
body>
</
html>
Thanks
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AutoGenerateColumns
=
"false"
PageSize
=
"10"
AllowPaging
=
"true"
AllowSorting
=
"true"
AllowMultiRowEdit
=
"True"
AllowMultiRowSelection
=
"true"
HorizontalAlign
=
"NotSet"
OnItemCommand
=
"RadGrid1_ItemCommand"
OnUpdateCommand
=
"RadGrid1_UpdateCommand"
>
<
MasterTableView
CommandItemDisplay
=
"top"
DataKeyNames
=
"JobId"
ClientDataKeyNames
=
"JobId"
EditMode
=
"InPlace"
HorizontalAlign
=
"NotSet"
>
<
Columns
>
<
telerik:GridEditCommandColumn
ItemStyle-Width
=
"100px"
FooterText
=
"EditCommand footer"
UniqueName
=
"EditCommandColumn"
HeaderText
=
"Edit"
HeaderStyle-Width
=
"100px"
UpdateText
=
"Update"
>
</
telerik:GridEditCommandColumn
>
<
telerik:GridBoundColumn
ItemStyle-Width
=
"50px"
HeaderStyle-Width
=
"50px"
ReadOnly
=
"true"
DataField
=
"JobId"
HeaderText
=
"Job Id"
DataType
=
"System.String"
>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
DataField
=
"JobCode"
HeaderText
=
"Job Code"
DataType
=
"System.String"
>
<
ItemTemplate
>
<%#DataBinder.Eval(Container.DataItem, "JobId")%>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadComboBox
runat
=
"server"
ID
=
"RadComboBox1"
EnableLoadOnDemand
=
"True"
DataTextField
=
"Job Code"
OnItemsRequested
=
"RadComboBox1_ItemsRequested"
DataValueField
=
"JobCode"
AutoPostBack
=
"false"
HighlightTemplatedItems
=
"true"
Height
=
"140px"
Width
=
"100px"
DropDownWidth
=
"100px"
OnSelectedIndexChanged
=
"RadComboBox1_OnSelectedIndexChanged"
SelectedValue='<%#Bind("JobId")%>' >
</
telerik:RadComboBox
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
ReadOnly
=
"true"
DataField
=
"Description"
HeaderText
=
"Description"
DataType
=
"System.String"
>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
DataField
=
"JobCodeMatch"
HeaderText
=
"Job Code Match"
DataType
=
"System.String"
>
<
ItemTemplate
>
<%#DataBinder.Eval(Container.DataItem, "JobCodeMatch")%>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadComboBox
runat
=
"server"
ID
=
"RadComboBox2"
EnableLoadOnDemand
=
"True"
DataTextField
=
"Job Code Match"
OnItemsRequested
=
"RadComboBox2_ItemsRequested"
DataValueField
=
"JobCodeMatch"
AutoPostBack
=
"false"
HighlightTemplatedItems
=
"True"
Height
=
"140px"
Width
=
"100px"
DropDownWidth
=
"100px"
OnSelectedIndexChanged
=
"RadComboBox2_OnSelectedIndexChanged"
SelectedValue='<%#Bind("JobCodeMatch")%>' >
</
telerik:RadComboBox
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
ReadOnly
=
"true"
DataField
=
"LaborText"
HeaderText
=
"Labor Flag"
DataType
=
"System.String"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
ReadOnly
=
"true"
DataField
=
"EditDate"
HeaderText
=
"Edit Date"
DataType
=
"System.String"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
ReadOnly
=
"true"
DataField
=
"Editor"
HeaderText
=
"Editor"
DataType
=
"System.String"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
ReadOnly
=
"true"
DataField
=
"Contact"
HeaderText
=
"Contact"
DataType
=
"System.String"
>
</
telerik:GridBoundColumn
>
</
Columns
>
<
EditFormSettings
>
</
EditFormSettings
>
</
MasterTableView
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"True"
EnableDragToSelectRows
=
"True"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
Protected
Sub
OnItemDataBoundHandler(
ByVal
sender
As
Object
,
ByVal
e
As
GridItemEventArgs)
If
e.Item.IsInEditMode
Then
Dim
item
As
GridEditableItem =
DirectCast
(e.Item, GridEditableItem)
Session(
"rcbValue"
) = e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)(
"JobId"
).ToString()
If
Not
(
TypeOf
e.Item
Is
IGridInsertItem)
Then
Dim
combo
As
RadComboBox =
DirectCast
(item.FindControl(
"RadComboBox1"
), RadComboBox)
End
If
End
If
End
Sub
Protected
Sub
RadComboBox1_ItemsRequested(
ByVal
sender
As
Object
,
ByVal
e
As
RadComboBoxItemsRequestedEventArgs)
oData = oPassThru.GetJobCodeIds(Profile.Business)
'(Profile.Business)
Dim
comboBox
As
RadComboBox =
DirectCast
(sender, RadComboBox)
comboBox.Items.Clear()
For
Each
o
As
clsAdminJobCodes
In
oData
Dim
item
As
New
RadComboBoxItem()
item.Text = o.JobId.ToString()
item.Value = o.JobId.ToString()
comboBox.Items.Add(item)
item.DataBind()
Next
End
Sub
Protected
Sub
RadComboBox2_ItemsRequested(
ByVal
sender
As
Object
,
ByVal
e
As
RadComboBoxItemsRequestedEventArgs)
oData = oPassThru.GetJobCodeMatchId(Profile.Business)
'(Profile.Business)
Dim
comboBox
As
RadComboBox =
DirectCast
(sender, RadComboBox)
comboBox.Items.Clear()
For
Each
o
As
clsAdminJobCodes
In
oData
Dim
item
As
New
RadComboBoxItem()
item.Text = o.JobCodeMatch.ToString()
item.Value = o.JobCodeMatch.ToString()
comboBox.Items.Add(item)
item.DataBind()
Next
End
Sub
Protected
Sub
RadGrid1_ItemCommand(
ByVal
source
As
Object
,
ByVal
e
As
GridCommandEventArgs)
If
(e.CommandName = RadGrid.EditCommandName)
Then
Session(
"rcbValue"
) = e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)(
"JobId"
).ToString()
End
If
End
Sub
Protected
Sub
RadGrid1_UpdateCommand(
ByVal
source
As
Object
,
ByVal
e
As
GridCommandEventArgs)
Dim
var3
As
String
=
CType
(RadGrid1.Items(0).FindControl(
"RadComboBox1"
), RadComboBox).SelectedValue
Dim
editedItem1
As
GridEditableItem = TryCast(e.Item, GridEditableItem)
Dim
var
As
String
=
CType
(editedItem1.Cells(4).Controls(1), RadComboBox).SelectedValue
Dim
Var2
As
String
=
CType
(editedItem1.Controls(4).FindControl(
"RadComboBox2"
), RadComboBox).SelectedValue
End
Sub
<
script
type
=
"text/javascript"
>
function OnDayRender(calendarInstance, args) {
6) and Sunday (day = 0))
var jsDate = new Date(args.get_date()[0], args.get_date()[1] - 1, args.get_date()[2]);
if (jsDate.getDay() == 0) {
var otherMonthCssClass = "CalendarDisabled";
args.get_cell().className = otherMonthCssClass;
args.get_cell().innerHTML = "<
span
>" + args.get_date()[2] + "</
span
>";
args.get_cell().DayId = "";
} else {
var otherMonthCssClass = "CalendarEnabled";
args.get_cell().className = otherMonthCssClass;
args.get_cell().innerHTML = "<
span
>" + args.get_date()[2] + "</
span
>";
}
}
</
script
>
Protected Sub Calendar_OnDayRender(ByVal sender As Object, ByVal e As Telerik.Web.UI.Calendar.DayRenderEventArgs)
Dim specialday As New RadCalendarDay
If e.Day.Date.DayOfWeek = DayOfWeek.Sunday Then
specialday.Date = e.Day.Date
specialday.IsSelectable = False
specialday.ToolTip = "Closed"
specialday.ItemStyle.CssClass = "CalendarDisabled"
With rdpDatePicker
.Calendar.SpecialDays.Add(specialday)
End With
ElseIf e.Day.Date.DayOfWeek = DayOfWeek.Saturday Then
specialday.Date = e.Day.Date
specialday.IsSelectable = True
specialday.ItemStyle.CssClass = "CalendarEnabled"
With rdpDatePicker
.Calendar.SpecialDays.Add(specialday)
End With
End If
End Sub