Hi,
I have a aspx page, and in that page i have a gridview with place holder as a item. i am binding some user controls which contains radgrid, and are being add to place holder dynamically.
the problem is: the radcontrols item events are not firing.
but when i use them in saperate aspx page, everything works fine.
Could you please take a look at following code and help us...
Thank you
v.
aspx page
I have a aspx page, and in that page i have a gridview with place holder as a item. i am binding some user controls which contains radgrid, and are being add to place holder dynamically.
the problem is: the radcontrols item events are not firing.
but when i use them in saperate aspx page, everything works fine.
Could you please take a look at following code and help us...
Thank you
v.
aspx page
<
asp:GridView
ID
=
"EvalGridView"
runat
=
"server"
AutoGenerateColumns
=
"False"
DataKeyNames
=
"ID"
>
<
Columns
>
<
asp:TemplateField
HeaderText
=
"EVALUATION FOR THE "
SortExpression
=
"Requirements"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"ControlNameLabel"
runat
=
"server"
Text='<%# Bind("ControlName") %>' Visible="false" />
<
asp:Label
ID
=
"ShowDropDown"
runat
=
"server"
Text='<%# Bind("Qualified") %>' Visible="false" />
<
asp:Label
ID
=
"ShowCheckBox"
runat
=
"server"
Text='<%# Bind("ChoiceBox") %>' Visible="false" />
<
asp:Label
ID
=
"lblEducatorEvaluationsID"
runat
=
"server"
Text='<%# Bind("ID") %>' Visible="false" />
<
asp:UpdatePanel
ID
=
"updpnlEval"
runat
=
"server"
>
<
ContentTemplate
>
<
asp:Table
id
=
"tblEvalTable"
runat
=
"server"
>
<
asp:TableRow
VerticalAlign
=
"Top"
>
<
asp:TableCell
width
=
"60px"
ID
=
"td1"
runat
=
"server"
>
<
asp:DropDownList
ID
=
"ddlYorN"
Width
=
"60px"
runat
=
"server"
>
<
asp:ListItem
Value
=
"0"
Text
=
"Select"
Selected
=
"True"
/>
<
asp:ListItem
Value
=
"1"
Text
=
"Yes"
/>
<
asp:ListItem
Value
=
"2"
Text
=
"No"
/>
</
asp:DropDownList
>
</
asp:TableCell
>
<
asp:TableCell
width
=
"20px"
ID
=
"td2"
runat
=
"server"
>
<
asp:CheckBox
ID
=
"chkReqConsidered"
runat
=
"server"
/>
</
asp:TableCell
>
<
asp:TableCell
>
</
asp:TableCell
>
<
asp:TableCell
>
<
asp:Label
ID
=
"RequirementsLabel"
runat
=
"server"
Text='<%# Bind("Requirements") %>' CssClass="normal" />
<
br
/>
<
asp:PlaceHolder
runat
=
"server"
ID
=
"phUserControl"
/>
</
asp:TableCell
>
<
asp:TableCell
>
<
asp:LinkButton
ID
=
"lnkbtnAddOrUpdateCredentials"
CssClass
=
"bottomhyperlink"
CommandArgument='<%# Bind("ID") %>' style="float:right;" runat="server">
</
asp:LinkButton
>
</
asp:TableCell
>
</
asp:TableRow
>
</
asp:Table
>
</
ContentTemplate
>
</
asp:UpdatePanel
>
<
asp:UpdateProgress
DynamicLayout
=
"false"
ID
=
"updpnlprgTechEval"
runat
=
"server"
>
<
ProgressTemplate
>
<
div
style="position: fixed; top: 0%; right: 50%; background-color: #FFFFBC; padding: 2em 2em 2em 2em;
font-weight: bolder; border: solid .1em Brown">
<
img
alt
=
"Processing your request, Please wait"
src
=
"../Images/indicator.gif"
/>
Please wait...
</
div
>
</
ProgressTemplate
>
</
asp:UpdateProgress
>
</
ItemTemplate
>
</
asp:TemplateField
>
</
Columns
>
</
asp:GridView
>
ascx control
<
telerik:RadGrid
ID
=
"radGridCourseInfo"
runat
=
"server"
Width
=
"100%"
AllowSorting
=
"true"
AutoGenerateColumns
=
"False"
GridLines
=
"None"
Skin
=
"Simple"
ShowStatusBar
=
"True"
ShowFooter
=
"true"
OnItemCommand
=
"radGridCourseInfo_ItemCommand"
OnItemCreated
=
"radGridCourseInfo_ItemCreated"
OnNeedDataSource
=
"radGridCourseInfo_NeedDataSource"
OnItemDataBound
=
"radGridCourseInfo_ItemDataBind"
>
<
ClientSettings
EnableRowHoverStyle
=
"true"
>
<
Selecting
AllowRowSelect
=
"true"
/>
<
Scrolling
UseStaticHeaders
=
"true"
/>
</
ClientSettings
>
<
MasterTableView
DataKeyNames
=
"EducatorCoursesID"
Width
=
"100%"
ShowHeadersWhenNoRecords
=
"true"
TableLayout
=
"Auto"
EditMode
=
"EditForms"
CommandItemSettings-AddNewRecordText
=
"Add New Course"
>
<
NoRecordsTemplate
>
No Records Available.
</
NoRecordsTemplate
>
<
Columns
>
<
telerik:GridButtonColumn
ButtonType
=
"ImageButton"
CommandName
=
"Delete"
Text
=
"Delete"
ConfirmText
=
"Are you sure you want to delete this Course.?"
ConfirmDialogType
=
"RadWindow"
UniqueName
=
"DeleteColumn"
ImageUrl
=
"~/Images/delete.gif"
ItemStyle-Width
=
"2%"
ItemStyle-HorizontalAlign
=
"Center"
HeaderText
=
"Delete"
>
</
telerik:GridButtonColumn
>
<
telerik:GridBoundColumn
DataField
=
"EducatorEvaluationID"
UniqueName
=
"SelectedEducatorEvaluationID"
Visible
=
"false"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"CourseNumber"
HeaderText
=
"COURSE"
ItemStyle-Width
=
"45%"
UniqueName
=
"Course"
SortExpression
=
"CourseNumber"
>
<
HeaderStyle
Width
=
"45%"
/>
<
ItemStyle
Width
=
"45%"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"CreditHourInput"
HeaderText
=
"HOURS"
ItemStyle-Width
=
"45%"
UniqueName
=
"CreditHourInput"
SortExpression
=
"CreditHourInput"
>
<
HeaderStyle
Width
=
"45%"
/>
<
ItemStyle
Width
=
"45%"
/>
</
telerik:GridBoundColumn
>
</
Columns
>
<
EditFormSettings
CaptionFormatString
=
"Edit ID: {0}"
CaptionDataField
=
"EducatorCoursesID"
EditFormType
=
"Template"
PopUpSettings-Modal
=
"true"
>
<
FormTemplate
>
<
br
/>
<
asp:Panel
ID
=
"pnlCourses"
runat
=
"server"
GroupingText
=
"Add Course Information"
>
<
br
/>
<
table
>
<
tr
valign
=
"top"
>
<
td
>
<
asp:Label
ID
=
"lblCourses"
runat
=
"server"
Text
=
"Course"
CssClass
=
"label"
Style
=
"margin: 0 0 0 0"
/>
</
td
>
<
td
>
<
img
src
=
"../Images/required.png"
alt
=
"Required Field"
/>
</
td
>
<
td
>
<
asp:TextBox
ID
=
"txtCourseNumber"
EnableViewState
=
"true"
runat
=
"server"
CssClass
=
"input"
/>
</
td
>
<
td
>
</
td
>
</
tr
>
<
tr
valign
=
"top"
>
<
td
>
<
asp:Label
ID
=
"lblHours"
runat
=
"server"
Text
=
"Hours"
CssClass
=
"label"
Style
=
"margin: 0 0 0 0"
/>
</
td
>
<
td
>
<
img
src
=
"../Images/required.png"
alt
=
"Required Field"
/>
</
td
>
<
td
>
<
asp:TextBox
ID
=
"txtCourseHours"
EnableViewState
=
"true"
runat
=
"server"
CssClass
=
"input integerOnly"
/>
</
td
>
<
td
>
<
telerik:RadComboBox
ID
=
"radCboHoursType"
runat
=
"server"
Skin
=
"Simple"
Width
=
"100px"
Height
=
"100px"
>
</
telerik:RadComboBox
>
</
td
>
</
tr
>
</
table
>
<
br
/>
<
asp:Label
ID
=
"lblAddErrorMsg"
runat
=
"server"
></
asp:Label
>
<
br
/>
<
asp:Button
ID
=
"btnSave"
CssClass
=
"buttonGreen"
Text
=
"ADD"
runat
=
"server"
CommandName
=
"PerformInsert"
/>
<
asp:Button
ID
=
"btnCancel"
CssClass
=
"buttonRed"
Text
=
"Cancel"
runat
=
"server"
CausesValidation
=
"False"
CommandName
=
"Cancel"
></
asp:Button
>
</
asp:Panel
>
</
FormTemplate
>
</
EditFormSettings
>
</
MasterTableView
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
/>
</
telerik:RadGrid
>
code behind for ascx:
protected void radGridCourseInfo_ItemCommand(object source, GridCommandEventArgs e)
{
if (e.CommandName == RadGrid.InitInsertCommandName)
{
}
else if (e.CommandName == RadGrid.PerformInsertCommandName)
{
TextBox otxtCourseNumber = (TextBox)(e.Item.FindControl("txtCourseNumber"));
TextBox otxtCourseHours = (TextBox)(e.Item.FindControl("txtCourseHours"));
RadComboBox oradCboHoursType = (RadComboBox)(e.Item.FindControl("radCboHoursType"));
CheckBox chkSelect = (CheckBox)(e.Item.FindControl("chkSelect"));
if (otxtCourseNumber != null && otxtCourseHours != null && oradCboHoursType != null)
{
if ((Utility.IsEmpty(otxtCourseHours.Text.ToString()) && !Utility.IsDecimal(otxtCourseHours.Text.ToString()))
|| Utility.IsEmpty(otxtCourseNumber.Text.ToString()))
{
mMessage = "'Course' and 'Hours' are Required.";
}
else if (oradCboHoursType.SelectedValue == "0")
{
mMessage = "Select Hours Type";
}
else
{
EducatorCourseEntity oECE = new EducatorCourseEntity();
oECE.EducatorID = m_lEducatorID;
oECE.CourseNumber = Utility.ReturnString(otxtCourseNumber.Text);
oECE.HourTypeID = Utility.ReturnInteger(oradCboHoursType.SelectedValue);
oECE.CreditHourInput = Utility.ReturnDecimal(otxtCourseHours.Text);
oECE.CompletionDt = null;
oECE.MaintainedBy = App.GetCurrentUserName;
int CredentialID = InsertCourses(oECE);
if (CredentialID > 0)
{
mMessage = "Educator Course Inserted.";
radGridCourseInfo.EditIndexes.Add(-1);
radGridCourseInfo.Rebind();
if (this.EnableEvalSettings == true)
{
EducatorEvaluationEntity oEEE = new EducatorEvaluationEntity();
oEEE.EducatorID = m_lEducatorID;
oEEE.EducatorCredentialID = CredentialID;
oEEE.CredentialTypeID = (int)Enumerations.CredentialTypeIDFor.Course;
oEEE.ApplicationID = this.ApplicationID;
oEEE.EvaluationID = this.EvaluationID;
oEEE.EducatorServiceID = this.EducatorServiceID;
oEEE.MaintainedBy = App.GetCurrentUserName;
//make checkbox selected upon sucessfull insertion.
UpdateEducatorEvaluationSelections(oEEE, Utility.ReturnDecimal(otxtCourseHours.Text));
this.Refresh();
}
}
else
{
mMessage = "Educator Course Insert Failed.";
}
}
}
else
{
mMessage = "Error..";
}
ShowErrorMsg(mMessage);
}
else if (e.CommandName == RadGrid.DeleteCommandName)
{
EducatorCourseEntity oECE = new EducatorCourseEntity();
oECE.EducatorCoursesID = Utility.ReturnInteger(((GridDataItem)(e.Item)).GetDataKeyValue("EducatorCoursesID"));
oECE.EducatorID = this.EducatorID;
mMessage = DeleteEducatorCourse(oECE) ? string.Empty : "Error: Unable to Delete Course";
}
else if (e.CommandName == "Cancel")
{
radGridCourseInfo.EditIndexes.Add(-1);
}
}