Hello
I am new in using Telerik Radpane control I am having a problem in accessing server controls which are inside a div which is present in radpane. I am not able to access them in my codebehind file, there are compilation errors like the name is not present in the current context for the same aspx page code behind file. How do we access asp controls inside a panel bar item template which has a radpane.
I am new in using Telerik Radpane control I am having a problem in accessing server controls which are inside a div which is present in radpane. I am not able to access them in my codebehind file, there are compilation errors like the name is not present in the current context for the same aspx page code behind file. How do we access asp controls inside a panel bar item template which has a radpane.
4 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 06 Jun 2013, 07:09 AM
Hi,
I have tried to access the controls inside RadPane and it worked as expected on my end. Please have a look into the following code.
ASPX:
C#:
Hope this will help you.
Thanks,
Shinu.
I have tried to access the controls inside RadPane and it worked as expected on my end. Please have a look into the following code.
ASPX:
<
telerik:RadSplitter
ID
=
"RadSplitter1"
runat
=
"server"
>
<
telerik:RadPane
ID
=
"RadPane1"
runat
=
"server"
>
<
div
>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
Text
=
"test"
/>
</
div
>
</
telerik:RadPane
>
</
telerik:RadSplitter
>
protected
void
button2_Click(
object
sender, EventArgs e)
{
Button1.Text=
"change"
;
//directly accessing with ID
}
Hope this will help you.
Thanks,
Shinu.
0

SKande
Top achievements
Rank 2
answered on 06 Jun 2013, 01:41 PM
Hello Shinu thank you for the reply actually my controls are inside a radpanelBar inside a radpanel item and i have gone through accessing asp controls inside a radpanel i am able to access them using a typecast and Find Control method but there is div section inside radpanel which is i am unable to access because there is no asp control that is called "div".
<radpanelbar>
<radpanelitems>
<itmes>
<radpanel item >
< radslitter>
<radpane>
<div id="123">
<imagebutton>
</radpane>
</radsplitter>
How can we change the style of that div and et that asp control.
<radpanelbar>
<radpanelitems>
<itmes>
<radpanel item >
< radslitter>
<radpane>
<div id="123">
<imagebutton>
</radpane>
</radsplitter>
How can we change the style of that div and et that asp control.
0
Accepted

Shinu
Top achievements
Rank 2
answered on 07 Jun 2013, 04:22 AM
Hi,
Try the following code snippet.
ASPX:
C#:
Hope this will help you.
Thanks,
Shinu.
Try the following code snippet.
ASPX:
<
telerik:RadPanelBar
ID
=
"RadPanelBar1"
runat
=
"server"
>
<
Items
>
<
telerik:RadPanelItem
runat
=
"server"
Value
=
"itemHolder"
>
<
ItemTemplate
>
<
telerik:RadSplitter
ID
=
"RadSplitter1"
runat
=
"server"
>
<
telerik:RadPane
ID
=
"RadPane1"
runat
=
"server"
>
<
div
id
=
"div1"
runat
=
"server"
>
<
asp:Button
ID
=
"Button2"
runat
=
"server"
Text
=
"test"
/>
</
div
>
</
telerik:RadPane
>
</
telerik:RadSplitter
>
</
ItemTemplate
>
</
telerik:RadPanelItem
>
</
Items
>
</
telerik:RadPanelBar
>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
Text
=
"click"
OnClick
=
"Button1_Click"
/>
C#:
protected
void
Button1_Click(
object
sender, EventArgs e)
{
RadSplitter rd = (RadSplitter)RadPanelBar1.FindItemByValue(
"itemHolder"
).FindControl(
"RadSplitter1"
);
System.Web.UI.HtmlControls.HtmlGenericControl div = (System.Web.UI.HtmlControls.HtmlGenericControl)rd.FindControl(
"div1"
);
// to access htmlcontrols in c#
Button Button1= (Button)rd.FindControl(
"Button2"
);
}
Hope this will help you.
Thanks,
Shinu.
0

SKande
Top achievements
Rank 2
answered on 07 Jun 2013, 05:20 PM
Perfect !!.