Hello
I have a grid with a template column like this
When I click the clear all button, in edit mode, I want the fields from the grid to be cleared and also set the readonly property to false( it is set to true in a previous state). So I set the command name, then catch it in RadGrid1_ItemCommand event handler and try to access a field like this:
But it seems that only the Label control exists! I can't find the RadTextBox or RadButton controls. I find this strange, since when the grid is in insert mode it works ok. I even tried to force the grid to be in edit mode
but still nothing.
Is there a way that I can use to solve this? Basically, I want a button that clears some fields when the grid is in edit or insert mode.
Thx a lot.
I have a grid with a template column like this
<
telerik:GridTemplateColumn
HeaderText
=
"Program Id"
AllowFiltering
=
"true"
Reorderable
=
"true"
SortExpression
=
"Program_Id"
UniqueName
=
"Program_Id"
DataField
=
"Program_Id"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblProgrammeId"
runat
=
"server"
Text='<%# Eval("Program_Id") %>' />
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadTextBox
ID
=
"txbProgrammeId"
Width
=
"50px"
runat
=
"server"
TextMode
=
"SingleLine"
Text='<%# Bind("Program_Id") %>' />
<
telerik:RadButton
ID
=
"ValidateProgBtn"
AutoPostBack
=
"true"
runat
=
"server"
Width
=
"16px"
Height
=
"16px"
CommandName
=
"ValidateProgId"
ToolTip
=
"Validate the programme id"
Text
=
"Cancel"
>
<
Image
ImageUrl
=
"Images/1305817624_clean.png"
/>
</
telerik:RadButton
>
<%--OnClientClicked="ClearFields" OnClientClicking="OnClientButtonClickingHandler"--%>
<
telerik:RadButton
ID
=
"RadButton1"
AutoPostBack
=
"true"
Value
=
"NoPostBack"
runat
=
"server"
Width
=
"16px"
Height
=
"16px"
CommandName
=
"Clear All"
ToolTip
=
"Clear the fields"
Text
=
"Clear"
>
<
Image
ImageUrl
=
"Images/1305817654_edit-clear.png"
/>
</
telerik:RadButton
>
<
asp:Label
ID
=
"IsNewProgLbl"
runat
=
"server"
style
=
"width:auto; color:Orange"
Text
=
""
></
asp:Label
>
</
EditItemTemplate
>
<
ItemStyle
VerticalAlign
=
"Top"
/>
</
telerik:GridTemplateColumn
>
When I click the clear all button, in edit mode, I want the fields from the grid to be cleared and also set the readonly property to false( it is set to true in a previous state). So I set the command name, then catch it in RadGrid1_ItemCommand event handler and try to access a field like this:
......
if (e.CommandName == "Clear All")
{
(e.Item.FindControl("txbProgrammeId") as RadTextBox).Text = "";
(e.Item.FindControl("txbProgrammeId") as RadTextBox).ReadOnly = false;
...........
e.Item.Edit = true;
GridEditableItem editedItem = e.Item as GridEditableItem;
Is there a way that I can use to solve this? Basically, I want a button that clears some fields when the grid is in edit or insert mode.
Thx a lot.