I am having a hard time trying to load my controls inside a RadDock that uses ascx.\
This is my code (it is same as the Portal Demo)
And here is my ASCX
The code in my aspx can't find the txtQuestion textbox.
This is my code (it is same as the Portal Demo)
protected
void
ButtonAddDock_Click(
object
sender, EventArgs e)
{
RadDock dock = CreateRadDock();
RadDockZone dz = RadDockZone1;
RadDockLayout1.Controls.Add(dock);
dock.Dock(dz);
CreateSaveStateTrigger(dock);
dock.Tag =
"Templates/NewQuiz.ascx"
;
LoadWidget(dock);
}
private
void
LoadWidget(RadDock dock)
{
if
(
string
.IsNullOrEmpty(dock.Tag) || dock.Closed)
{
return
;
}
Control widget = LoadControl(dock.Tag);
widget.EnableViewState =
false
;
dock.ContentContainer.Controls.Add(widget);
}
protected
void
btnSaveDraft_Click(
object
sender, EventArgs e)
{
string
[] questions = {};
int
x = 0;
foreach
(RadDock dock
in
RadDockLayout1.RegisteredDocks)
{
RadTextBox txtQuestion = (RadTextBox)dock.ContentContainer.FindControl(
"txtQuestion"
);
questions[x]= txtQuestion.Text;
x++;
}
}
And here is my ASCX
<
center
style
=
"padding-top: 15px;"
>
<
table
style
=
"text-align: justify;"
>
<
tr
>
<
td
style
=
"width: 15%;"
>
Question:
</
td
>
<
td
>
<
telerik:RadTextBox
ID
=
"txtQuestion"
runat
=
"server"
Width
=
"100%"
>
</
telerik:RadTextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"width: 15%;"
>
Help Text:
</
td
>
<
td
>
<
telerik:RadTextBox
ID
=
"txtHelp"
runat
=
"server"
Width
=
"100%"
>
</
telerik:RadTextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"width: 15%;"
>
Mandatory:
</
td
>
<
td
>
<
asp:CheckBox
ID
=
"chkMandatory"
runat
=
"server"
/>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"width: 15%;"
>
Question Weight:
</
td
>
<
td
>
<
telerik:RadTextBox
ID
=
"txtWeight"
runat
=
"server"
Width
=
"30px"
Text
=
"1"
>
</
telerik:RadTextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"width: 15%;"
>
Question Type:
</
td
>
<
td
>
<
telerik:RadComboBox
ID
=
"ddlType"
runat
=
"server"
AutoPostBack
=
"True"
>
<
Items
>
<
telerik:RadComboBoxItem
runat
=
"server"
Selected
=
"True"
Text
=
"--Select Question Type--"
Value
=
"--Select Question Type--"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"Multiple Choice - Radio Button"
Value
=
"Multiple Choice - Radio Button"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"Multiple Choice - Check Box"
Value
=
"Multiple Choice - Check Box"
/>
</
Items
>
</
telerik:RadComboBox
>
</
td
>
</
tr
>
</
table
>
</
center
>
The code in my aspx can't find the txtQuestion textbox.