Hello,
I have Grid with Edit mode of "EditForms". When the user clicks the edit button, it brings up an edit tree with two radio buttons with the same group name and two buttons: approve and cancel. By default, neither of the radio buttons are checked. I want to make it so that when the user clicks the approve button and neither radio button is checked, it does not close the edit form.
Here is the radgrid declaration:
Here is the edit form:
here is the code for the approveButton:
Thanks,
Justin
I have Grid with Edit mode of "EditForms". When the user clicks the edit button, it brings up an edit tree with two radio buttons with the same group name and two buttons: approve and cancel. By default, neither of the radio buttons are checked. I want to make it so that when the user clicks the approve button and neither radio button is checked, it does not close the edit form.
Here is the radgrid declaration:
<
telerik:RadGrid
ID
=
"approvalGrid"
runat
=
"server"
AllowPaging
=
"true"
ShowStatusBar
=
"true"
ShowFooter
=
"false"
AllowFilteringByColumn
=
"false"
FilterItemStyle-HorizontalAlign
=
"Center"
ShowGroupPanel
=
"false"
AutoGenerateColumns
=
"false"
PageSize
=
"25"
AllowSorting
=
"true"
AllowMultiRowSelection
=
"false"
GirdLines
=
"Vertical"
Skin
=
"WebBlue"
AlternatingItemStyle-HorizontalAlign
=
"Center"
ItemStyle-HorizontalAlign
=
"Center"
HeaderStyle-HorizontalAlign
=
"Center"
GroupingSettings-CaseSensitive
=
"false"
AllowAutomaticInserts
=
"false"
AllowAutomaticUpdates
=
"false"
AllowAutomaticDeletes
=
"true"
OnItemCommand
=
"approvalGrid_ItemCommand"
OnNeedDataSource
=
"approvalGrid_NeedDataSource"
OnItemDataBound
=
"approvalGrid_ItemDataBound"
Width
=
"1080"
EnableLinqExpressions
=
"false"
>
Here is the edit form:
<
EditFormSettings
CaptionFormatString
=
" Approve ID #{0}"
CaptionDataField
=
"ID"
EditFormType
=
"Template"
>
<
PopUpSettings
Modal
=
"false"
Width
=
"550px"
/>
<
FormTemplate
>
<
asp:Label
ID
=
"ApprovalWindowError"
runat
=
"server"
Font-Bold
=
"true"
Font-Size
=
"Large"
Font-Underline
=
"true"
ForeColor
=
"#990000"
/
<
fieldset
>
<
legend
><
asp:Label
ID
=
"editLabel"
runat
=
"server"
Text
=
"Select A Location"
Font-Bold
=
"true"
Font-Size
=
"Medium"
></
asp:Label
> </
legend
>
<
table
>
<
tr
>
<
td
align
=
"left"
>
Original Location:
</
td
>
<
td
align
=
"left"
>
<
telerik:RadButton
ID
=
"SendToOrig"
runat
=
"server"
ButtonType
=
"ToggleButton"
ToggleType
=
"Radio"
GroupName
=
"ApproveGroup"
Text='<%#Bind("OrigLocation") %>'>
</
telerik:RadButton
>
</
td
>
</
tr
>
<
tr
>
<
td
align
=
"left"
>
Receiving Location:
</
td
>
<
td
align
=
"left"
>
<
telerik:RadButton
ID
=
"SendToLocation"
runat
=
"server"
ButtonType
=
"ToggleButton"
ToggleType
=
"Radio"
GroupName
=
"ApproveGroup"
Text='<%#Bind("Location") %>'>
</
telerik:RadButton
>
</
td
>
</
tr
>
</
table
>
<
table
>
<
tr
>
<
td
align
=
"right"
>
<
telerik:RadButton
ID
=
"approveButton"
runat
=
"server"
Text
=
"Approve"
Font-Bold
=
"true"
CommandName
=
"Update"
></
telerik:RadButton
>
<
telerik:RadButton
ID
=
"cancelButton"
runat
=
"server"
Text
=
"Cancel"
Font-Bold
=
"true"
CommandName
=
"Cancel"
></
telerik:RadButton
>
</
td
>
</
tr
>
</
table
>
</
fieldset
>
</
FormTemplate
>
</
EditFormSettings
>
here is the code for the approveButton:
protected
void
approvalGrid_ItemCommand(
object
sender, GridCommandEventArgs e)
{
if
(e.CommandName ==
"Update"
)
{
GridEditableItem item = e.Item
as
GridEditableItem;
//checks if at least one radio is pushed
if
((item.FindControl(
"SendToOrig"
)
as
RadButton).Checked || (item.FindControl(
"SendToLocation"
)
as
RadButton).Checked)
{
if
((item.FindControl(
"SendToOrig"
)
as
RadButton).Checked)
{
successLabel.Text =
"Adjustment Approved For Original Location"
;
}
else
{
successLabel.Text =
"Adjustment Approved For Receiving Location"
;
}
}
//if neither radios are pushed
else
{
errorLabel.Text =
"Approval Failed: You Did Not Select A Location"
;
}
}
if
(e.CommandName ==
"Cancel"
)
{
errorLabel.Text =
"Approval Canceled"
;
}
}
Thanks,
Justin