or
this._RadGrid1.ClientSettings.ClientEvents.OnRowSelected = "OnRowSelected";
function OnRowSelected(sender, args) {
var grid = args.get_tableView();
var selectedRows = grid.get_selectedItems();
for (var i = 0; i < selectedRows.length; i++) {
var row = selectedRows[i];
}
}
function RefreshGrid() {
var masterTable = $find("<%= RadGrid_Qualification.ClientID %>").get_masterTableView();
masterTable.rebind();
}
GridDataItem parentItem = e.Item.OwnerTableView.ParentItem;
int PosId = Convert.ToInt32(parentItem.OwnerTableView.DataKeyValues[parentItem.ItemIndex]["intpositionId"]);
// all the Insert Commands for the Grids in order of Grid Heirarchy
//Insert command for the Sections 1st level
if (e.CommandName == RadGrid.PerformInsertCommandName && e.Item.OwnerTableView.Name == "Sections")
{
GridEditableItem item = e.Item as GridEditableItem;
TextBox section = (TextBox)item.FindControl("txtSection");
sql = "Execute usp_InsertSection '" + c.SanitizeString(section.Text) + "', " + c.GetUserId();
c.InsertUpdateDelete(sql);
myradGrid.Rebind();
}
//Insert command for positions 2nd Level
if (e.CommandName == RadGrid.PerformInsertCommandName && e.Item.OwnerTableView.Name == "Positions")
{
GridEditableItem item = e.Item as GridEditableItem;
GridDataItem parentItem = e.Item.OwnerTableView.ParentItem;
//int sectionId = Convert.ToInt32(item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["intSectionId"]);
int secId = Convert.ToInt32(parentItem.OwnerTableView.DataKeyValues[parentItem.ItemIndex]["intSectionId"]);
TextBox descrip = (TextBox)item.FindControl("txtdescription");
TextBox scale = (TextBox)item.FindControl("txtScale");
TextBox posType = (TextBox)item.FindControl("txtPosType");
TextBox grade = (TextBox)item.FindControl("txtGrade");
sql = "Execute usp_InsertPosition " + secId + ", '" + c.SanitizeString(descrip.Text) + "', '" + c.SanitizeString(scale.Text) + "', '" + c.SanitizeString(posType.Text) + "', '" + c.SanitizeString(grade.Text) + "'";
c.InsertUpdateDelete(sql);
}
//Insert for Personnel added to the Position 3rd Level
if (e.CommandName == RadGrid.PerformInsertCommandName && e.Item.OwnerTableView.Name == "Personnel")
{
GridEditableItem item = e.Item as GridEditableItem;
GridDataItem parentItem = e.Item.OwnerTableView.ParentItem;
int PosId = Convert.ToInt32(parentItem.OwnerTableView.DataKeyValues[parentItem.ItemIndex]["intpositionId"]);
CheckBox backfill = (CheckBox)item.FindControl("cbBackFill");
CheckBox manager = (CheckBox)item.FindControl("cbManager");
CheckBox assistManager = (CheckBox)item.FindControl("cbAssistMan");
int backfillck = 0;
int managerck = 0;
int assManagerck = 0;
if (backfill.Checked == true)
{
backfillck = 1;
}
if (manager.Checked == true)
{
managerck = 1;
}
if (assistManager.Checked == true)
{
assManagerck = 1;
}
sql = "Execute usp_InsertPersonnel " + PosId + ", " + HFAdminId.Value + ", " + backfillck + ", " + managerck + ", " + assManagerck + "";
Response.Write(sql);
Response.End();
c.InsertUpdateDelete(sql);
}
this._RadGrid1.AllowSorting = true;
this._RadGrid1.AllowFilteringByColumn = true;
this._RadGrid1.AutoGenerateColumns = false;
this._RadGrid1.EnableLinqExpressions = false;
this._RadGrid1.ClientSettings.Selecting.AllowRowSelect = true;
this._RadGrid1.MasterTableView.DataKeyNames = "...";
this._RadGrid1.MasterTableView.ClientDataKeyNames = "..";
this._RadGrid1.NeedDataSource += RadGrid1_NeedDataSource;
I have added checkboxtemplate to the grid.
The following are added to RadAjaxPanel.
this.RadAjaxPanel.Controls.Add(this._RadLoadingPanel);
this.RadAjaxPanel.Controls.Add(this._RadGrid1);
this.RadAjaxPanel.Controls.Add(this._textBox1);
this.RadAjaxPanel.Controls.Add(this._button1);
function GetSelectedItems() {
var g = $find("<%=RadGrid1.ClientID %>");
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AllowAutomaticDeletes
=
"True"
AllowAutomaticInserts
=
"True"
AllowAutomaticUpdates
=
"True"
AllowPaging
=
"True"
AllowSorting
=
"True"
Culture
=
"it-IT"
DataSourceID
=
"SqlDataSource1"
PageSize
=
"20"
Width
=
"100%"
Skin
=
"Outlook"
>
<
ExportSettings
>
<
Pdf
PageWidth
=
""
>
</
Pdf
>
</
ExportSettings
>
<
MasterTableView
AutoGenerateColumns
=
"False"
CommandItemDisplay
=
"Top"
DataKeyNames
=
"Id"
DataSourceID
=
"SqlDataSource1"
>
<
Columns
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
>
<
HeaderStyle
Width
=
"30px"
/>
</
telerik:GridEditCommandColumn
>
<
telerik:GridBoundColumn
DataField
=
"Id"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter Id column"
HeaderText
=
"Id"
ReadOnly
=
"True"
SortExpression
=
"Id"
UniqueName
=
"Id"
>
<
ColumnValidationSettings
>
<
ModelErrorMessage
Text
=
""
/>
</
ColumnValidationSettings
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"name"
FilterControlAltText
=
"Filter name column"
HeaderText
=
"Name"
SortExpression
=
"name"
UniqueName
=
"name"
>
<
ColumnValidationSettings
EnableModelErrorMessageValidation
=
"True"
EnableRequiredFieldValidation
=
"True"
RenderValidatorBeforeEditor
=
"True"
>
<
RequiredFieldValidator
ErrorMessage
=
"This filed is required! "
ForeColor
=
"Red"
></
RequiredFieldValidator
>
</
ColumnValidationSettings
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"surname"
FilterControlAltText
=
"Filter surname column"
HeaderText
=
"Surname"
SortExpression
=
"surname"
UniqueName
=
"surname"
>
<
ColumnValidationSettings
EnableModelErrorMessageValidation
=
"True"
EnableRequiredFieldValidation
=
"True"
RenderValidatorBeforeEditor
=
"True"
>
<
RequiredFieldValidator
ErrorMessage
=
"This filed is required! "
ForeColor
=
"Red"
></
RequiredFieldValidator
>
</
ColumnValidationSettings
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"userName"
DefaultInsertValue
=
""
FilterControlAltText
=
"Filter userName column"
HeaderText
=
"User Name"
SortExpression
=
"userName"
UniqueName
=
"userName"
>
<
ColumnValidationSettings
EnableModelErrorMessageValidation
=
"True"
EnableRequiredFieldValidation
=
"True"
RenderValidatorBeforeEditor
=
"True"
>
<
RequiredFieldValidator
ErrorMessage
=
"This filed is required! "
ForeColor
=
"Red"
></
RequiredFieldValidator
>
</
ColumnValidationSettings
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"password"
DefaultInsertValue
=
""
FilterControlAltText
=
"Filter password column"
HeaderText
=
"Password"
SortExpression
=
"password"
UniqueName
=
"password"
Display
=
"False"
>
<
ColumnValidationSettings
EnableModelErrorMessageValidation
=
"True"
EnableRequiredFieldValidation
=
"True"
RenderValidatorBeforeEditor
=
"True"
>
<
RequiredFieldValidator
ErrorMessage
=
"This filed is required! "
ForeColor
=
"Red"
></
RequiredFieldValidator
>
</
ColumnValidationSettings
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"email"
DefaultInsertValue
=
"@stadlerrail.com"
FilterControlAltText
=
"Filter email column"
HeaderText
=
"Email"
SortExpression
=
"email"
UniqueName
=
"email"
>
<
ColumnValidationSettings
EnableModelErrorMessageValidation
=
"True"
EnableRequiredFieldValidation
=
"True"
RenderValidatorBeforeEditor
=
"True"
>
<
RequiredFieldValidator
ErrorMessage
=
"This filed is required! "
ForeColor
=
"Red"
></
RequiredFieldValidator
>
</
ColumnValidationSettings
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"telephone"
DefaultInsertValue
=
"+"
FilterControlAltText
=
"Filter telephone column"
HeaderText
=
"Telephone"
SortExpression
=
"telephone"
UniqueName
=
"telephone"
>
<
ColumnValidationSettings
EnableModelErrorMessageValidation
=
"True"
EnableRequiredFieldValidation
=
"True"
RenderValidatorBeforeEditor
=
"True"
>
<
RequiredFieldValidator
ErrorMessage
=
"This filed is required! "
ForeColor
=
"Red"
></
RequiredFieldValidator
>
</
ColumnValidationSettings
>
</
telerik:GridBoundColumn
>
<
telerik:GridButtonColumn
ButtonType
=
"ImageButton"
Text
=
"Delete"
CommandName
=
"Delete"
FilterControlAltText
=
"Filter column1 column"
ConfirmDialogType
=
"RadWindow"
ConfirmText
=
"Do you really want to delete this project and all its content?"
UniqueName
=
"column1"
>
<
HeaderStyle
Width
=
"30px"
/>
</
telerik:GridButtonColumn
>
</
Columns
>
<
EditFormSettings
EditFormType
=
"Template"
>
<
EditColumn
UniqueName
=
"EditCommandColumn1"
FilterControlAltText
=
"Filter EditCommandColumn1 column"
></
EditColumn
>
<
FormTemplate
>
<
style
type
=
"text/css"
>
.auto-style1 {
width: 100%;
background-color: azure;
}
.auto-style2 {
width: 84px;
}
.auto-style5 {
text-align: left;
width: 386px;
}
</
style
>
<
table
class
=
"auto-style1"
>
<
tr
>
<
td
class
=
"auto-style2"
></
td
>
<
td
class
=
"auto-style5"
> </
td
>
</
tr
>
<
tr
>
<
td
class
=
"auto-style2"
>Name:</
td
>
<
td
class
=
"auto-style5"
>
<
asp:TextBox
ID
=
"name"
runat
=
"server"
Width
=
"200px"
Height
=
"22px"
Text='<%# Bind( "name" ) %>'>></
asp:TextBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator2"
ControlToValidate
=
"name"
ErrorMessage
=
"This field shall be filled"
runat
=
"server"
BackColor
=
"Red"
>
</
asp:RequiredFieldValidator
>
<
asp:RegularExpressionValidator
ID
=
"validateName"
runat
=
"server"
ErrorMessage
=
"Invalid Name. You shall insert letters only."
ForeColor
=
"Red"
ControlToValidate
=
"name"
ValidationExpression
=
"^[^\W\d_]+$"
/>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"auto-style2"
>Surname:</
td
>
<
td
class
=
"auto-style5"
>
<
asp:TextBox
ID
=
"surname"
runat
=
"server"
Width
=
"200px"
Height
=
"22px"
Text='<%# Bind( "surname" ) %>'>></
asp:TextBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator3"
ControlToValidate
=
"surname"
ErrorMessage
=
"This field shall be filled"
runat
=
"server"
BackColor
=
"Red"
>
</
asp:RequiredFieldValidator
>
<
asp:RegularExpressionValidator
ID
=
"validateSurname"
runat
=
"server"
ErrorMessage
=
"Invalid Surname. You shall insert letters only."
ForeColor
=
"Red"
ControlToValidate
=
"surname"
ValidationExpression
=
"^[^\W\d_]+$"
/>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"auto-style2"
>User Name:</
td
>
<
td
class
=
"auto-style5"
>
<
asp:TextBox
ID
=
"userName"
runat
=
"server"
Width
=
"200px"
Height
=
"22px"
Text='<%# Bind( "userName" ) %>'>></
asp:TextBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator1"
ControlToValidate
=
"UserName"
ErrorMessage
=
"This field shall be filled"
runat
=
"server"
BackColor
=
"Red"
>
</
asp:RequiredFieldValidator
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"auto-style2"
>Password:</
td
>
<
td
class
=
"auto-style5"
>
<
asp:TextBox
ID
=
"password"
runat
=
"server"
Width
=
"200px"
TextMode
=
"Password"
Height
=
"22px"
Text='<%# Bind( "password" ) %>'>></
asp:TextBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator7"
ControlToValidate
=
"password"
ErrorMessage
=
"This field shall be filled"
runat
=
"server"
BackColor
=
"Red"
>
</
asp:RequiredFieldValidator
>
<
asp:RegularExpressionValidator
ID
=
"validatePassword"
runat
=
"server"
ErrorMessage
=
"Password shall at least 8 characters that contains at least one lowercase and one uppercase ASCII character and also at least one character from the set @#$%^&+= (in any order)"
ForeColor
=
"Red"
ControlToValidate
=
"password"
ValidationExpression
=
"^(?=.{8,})(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=]).*$"
/>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"auto-style2"
>Email:</
td
>
<
td
class
=
"auto-style5"
>
<
asp:TextBox
ID
=
"email"
runat
=
"server"
Width
=
"200px"
Height
=
"22px"
Text='<%# Bind( "email" ) %>'>></
asp:TextBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator9"
ControlToValidate
=
"email"
ErrorMessage
=
"This field shall be filled"
runat
=
"server"
BackColor
=
"Red"
>
</
asp:RequiredFieldValidator
>
<
asp:RegularExpressionValidator
ID
=
"validateEmail"
runat
=
"server"
ErrorMessage
=
"Invalid email. name.surname@stadlerrail.com"
ForeColor
=
"Red"
ControlToValidate
=
"email"
ValidationExpression
=
"^[a-zA-Z0-9_]+\.[a-zA-Z0-9_]+@stadlerrail.com$"
/>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"auto-style2"
>Telephone:</
td
>
<
td
class
=
"auto-style5"
>
<
asp:TextBox
ID
=
"telephone"
runat
=
"server"
Width
=
"200px"
Height
=
"22px"
Text='<%# Bind( "telephone" ) %>'>></
asp:TextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"auto-style2"
> </
td
>
<
td
> </
td
>
</
tr
>
<
tr
>
<
td
class
=
"auto-style2"
> </
td
>
<
td
class
=
"auto-style5"
>
<
asp:Button
ID
=
"btnUpdate"
Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></
asp:Button
>
<
asp:Button
ID
=
"btnCancel"
Text
=
"Cancel"
runat
=
"server"
CausesValidation
=
"False"
CommandName
=
"Cancel"
Style
=
"text-align: right"
></
asp:Button
>
</
td
>
</
tr
>
</
table
>
</
FormTemplate
>
</
EditFormSettings
>
</
MasterTableView
>
</
telerik:RadGrid
>
DataBinding: 'Telerik.Web.UI.GridInsertionObject' does not contain a property with the name 'strDescription'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: DataBinding: 'Telerik.Web.UI.GridInsertionObject' does not contain a property with the name 'strDescription'.
<
EditFormSettings
EditFormType
=
"Template"
>
<
FormTemplate
>
<
table
style
=
"width:100%;background-color:antiquewhite"
>
<
tr
>
<
td
style
=
"height:10px"
></
td
>
</
tr
>
<
tr
>
<
td
style
=
"width:10%;text-align:right"
>Position Description: </
td
>
<
td
style
=
"width:90%;text-align:left"
><
asp:TextBox
ID
=
"txtdescription"
runat
=
"server"
Width
=
"200px"
Text='<%#Bind("strDescription") %>'></
asp:TextBox
></
td
>
</
tr
>
<
tr
>
<
td
style
=
"height:10px"
></
td
>
</
tr
>
<
tr
>
<
td
style
=
"width:10%;text-align:right"
>Position Scale: </
td
>
<
td
style
=
"width:90%;text-align:left"
><
asp:TextBox
ID
=
"txtScale"
runat
=
"server"
Width
=
"200px"
Text='<%#Bind("strScale") %>'></
asp:TextBox
></
td
>
</
tr
>
<
tr
>
<
td
style
=
"height:10px"
></
td
>
</
tr
>
<
tr
>
<
td
style
=
"width:10%;text-align:right"
>Position Type: </
td
>
<
td
style
=
"width:90%;text-align:left"
><
asp:TextBox
ID
=
"txtPosType"
runat
=
"server"
Width
=
"200px"
Text='<%#Bind("strPositionType") %>'></
asp:TextBox
></
td
>
</
tr
>
<
tr
>
<
td
style
=
"height:10px"
></
td
>
</
tr
>
<
tr
>
<
td
style
=
"width:10%;text-align:right"
>Position Grade: </
td
>
<
td
style
=
"width:90%;text-align:left"
><
asp:TextBox
ID
=
"txtGrade"
runat
=
"server"
Width
=
"200px"
Text='<%#Bind("strGrade") %>'></
asp:TextBox
></
td
>
</
tr
>
<
tr
>
<
td
style
=
"height:5px"
></
td
>
</
tr
>
<
tr
>
<
td
style
=
"width:10%;text-align:right"
></
td
>
<
td
style
=
"width:90%;text-align:left"
>
<
asp:LinkButton
ID
=
"lnkSubmit"
runat
=
"server"
Text='<%# ((bool)DataBinder.Eval(Container, "OwnerTableView.IsItemInserted")) ? "Insert" : "Update" %>'
CommandName='<%# ((bool)DataBinder.Eval(Container, "OwnerTableView.IsItemInserted")) ? "PerformInsert" : "Update" %>'>
</
asp:LinkButton
>
<
asp:LinkButton
ID
=
"lnkCancel"
runat
=
"server"
CausesValidation
=
"false"
CommandName
=
"Cancel"
Text
=
"Cancel"
></
asp:LinkButton
>
</
td
>
</
tr
>
</
table
>
</
FormTemplate
>
</
EditFormSettings
>
if (e.CommandName == RadGrid.PerformInsertCommandName && e.Item.OwnerTableView.Name == "Positions")
{
GridEditableItem item = e.Item as GridEditableItem;
GridDataItem parentItem = e.Item.OwnerTableView.ParentItem;
//int sectionId = Convert.ToInt32(item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["intSectionId"]);
int secId = Convert.ToInt32(parentItem.OwnerTableView.DataKeyValues[parentItem.ItemIndex]["intSectionId"]);
TextBox descrip = (TextBox)item.FindControl("txtdescription");
TextBox scale = (TextBox)item.FindControl("txtScale");
TextBox posType = (TextBox)item.FindControl("txtPosType");
TextBox grade = (TextBox)item.FindControl("txtGrade");
sql = "Execute usp_InsertPosition " + secId + ", '" + c.SanitizeString(descrip.Text) + "', '" + c.SanitizeString(scale.Text) + "', '" + c.SanitizeString(posType.Text) + "', '" + c.SanitizeString(grade.Text) + "'";
c.InsertUpdateDelete(sql);
// myradGrid.Rebind();
}
<script type=
"text/javascript"
>
function
ShowWindow(dealid) {
var
oWnd = window.radopen(
'Windows/DealReassignmentPopup.aspx'
,
'window1'
);
}
</script>
protected
void
gridAssignSingleDeal_ItemCommand(
object
sender, Telerik.Web.UI.GridCommandEventArgs e)
{
if
(e.CommandName ==
"OpenWindow"
)
{
int
datakeyvalue = Helper.IntHelper((e.Item
as
GridDataItem).GetDataKeyValue(
"ID"
));
string
script =
string
.Format(
"<script language='javascript' type='text/javascript'>Sys.Application.add_load(ShowWindow({0}));</script>"
,datakeyvalue);
ClientScript.RegisterStartupScript(
this
.GetType(),
"showWindow"
, script);
}
}