Hi,
I can access a TextBox control in RadGrid <DetailItemTemplate> in server side using C# [the code below works fine], but how can I access the TextBox in client side using javascript?
ASPX code:
C# code:
I can access a TextBox control in RadGrid <DetailItemTemplate> in server side using C# [the code below works fine], but how can I access the TextBox in client side using javascript?
ASPX code:
<
telerik:RadGrid
ID
=
"Grd_Pad"
runat
=
"server"
GridLines
=
"None"
AllowSorting
=
"true"
AllowPaging
=
"true"
PageSize
=
"20"
AllowFilteringByColumn
=
"true"
AutoGenerateColumns
=
"false"
AllowMultiRowSelection
=
"true"
AllowMultiRowEdit
=
"true"
AllowAutomaticInserts
=
"true"
AllowAutomaticUpdates
=
"true"
AllowAutomaticDeletes
=
"true"
DataSourceID
=
"Sql_Pad"
Width
=
"100%"
>
<
SortingSettings
SortToolTip
=
""
/>
<
FilterItemStyle
Width
=
"100%"
></
FilterItemStyle
>
<
GroupingSettings
CaseSensitive
=
"false"
></
GroupingSettings
>
<
PagerStyle
AlwaysVisible
=
"true"
Mode
=
"NextPrevAndNumeric"
/>
<
MasterTableView
DataKeyNames
=
"pad_id"
CommandItemDisplay
=
"Top"
EditMode
=
"InPlace"
GroupLoadMode
=
"Client"
GroupsDefaultExpanded
=
"true"
TableLayout
=
"Fixed"
Width
=
"100%"
>
<
telerik:GridTemplateColumn
DataField
=
"pad_name"
HeaderText
=
"Show Hide"
SortExpression
=
"pad_name"
UniqueName
=
"pad_showhide"
CurrentFilterFunction
=
"Contains"
ShowFilterIcon
=
"false"
FilterControlToolTip
=
""
FilterImageToolTip
=
""
FilterControlAltText
=
""
FilterControlWidth
=
"100%"
>
<
HeaderStyle
HorizontalAlign
=
"Left"
Width
=
"5%"
/>
<
ItemStyle
HorizontalAlign
=
"Left"
Width
=
"5%"
/>
<
ItemTemplate
>
<
telerik:RadButton
ID
=
"Btn_Pad_Toggle"
runat
=
"server"
Text
=
"Toggle"
ButtonType
=
"StandardButton"
ToggleType
=
"CheckBox"
AutoPostBack
=
"true"
OnClick
=
"CsPadShowHide"
>
<
ToggleStates
>
<
telerik:RadButtonToggleState
Text
=
"Show"
/>
<
telerik:RadButtonToggleState
Text
=
"Hide"
Selected
=
"true"
/>
</
ToggleStates
>
</
telerik:RadButton
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
DetailItemTemplate
>
<
telerik:RadTextBox
ID
=
"Txt_Pad_Dtl"
runat
=
"server"
TextMode
=
"MultiLine"
InputType
=
"Text"
Wrap
=
"false"
Label
=
""
Text='<%# Eval("pad_text") %>' EmptyMessage="None..."
AutoPostBack="false" Display="false" ReadOnly="true"
BorderColor="#25A0DA" BorderWidth="1px" Width="100%" Height="200px">
</
telerik:RadTextBox
>
</
DetailItemTemplate
>
</
MasterTableView
>
</
telerik:RadGrid
>
C# code:
protected
void
CsPadShowHide(
object
s, EventArgs e)
{
RadButton btn = (RadButton)s;
GridDataItem di = (GridDataItem)btn.NamingContainer;
RadTextBox pad = di.DetailTemplateItemDataCell.FindControl(
"Txt_Pad_Dtl"
)
as
RadTextBox;
//pad.Display = true; // Ali - works
pad.Display = btn.SelectedToggleState.Selected;
}