This is a migrated thread and some comments may be shown as answers.

get to user control

11 Answers 123 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
appdev
Top achievements
Rank 1
appdev asked on 13 Oct 2008, 01:31 PM
i have radpanelbar then items then radpanelitem then item then radpanelitem then itemtemplate . then inside this itemtemplate, i have an asp user control and this control is invisble. i could make it visible by doing this

document.getElementById('btnNext').style.visibility='visible';

but this is just regular html <input>. if i do this with user control like <asp:button> it doesn't work. could someone help? Thank you.

11 Answers, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 13 Oct 2008, 01:36 PM
Hello Duy,

The FindControl method provides you with a reference to any control inside any of the templates used in the RadPanelBar or any of its PanelItems. You have to make sure that you properly typecast the returned value as FindControl returns a reference to a Control class. After you get the reference you may modify any properties of the referenced control.

For details on the matter please take a look at this example.

Best wishes,
Paul
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
appdev
Top achievements
Rank 1
answered on 13 Oct 2008, 01:50 PM

 

var sssstextbox='<%=((TextBox)RadPanelBar1.Items[0].Items[0].FindControl("txtFileNameSaveas")).ClientID %>';

that is what i get.
Error 6 'TextBox' is a type and cannot be used as an expression. C:\Inetpub\wwwroot\Default.aspx 15

 

0
Paul
Telerik team
answered on 13 Oct 2008, 02:00 PM
Hello Duy,

Please find below a sample code snippet that shows the needed approach.

<html xmlns="http://www.w3.org/1999/xhtml">  
<head id="Head1" runat="server">  
    <title>Untitled Page</title> 
</head> 
 
<script type="text/javascript">  
function pageLoad()  
{     
    var sssstextbox = $get('<%= ((TextBox)RadPanelbar1.Items[0].Items[0].FindControl("TextBox1")).ClientID %>');  
    alert(sssstextbox.id);  
}  
</script> 
 
<body> 
    <form id="form1" runat="server">  
        <asp:ScriptManager ID="ScriptManager1" runat="server">  
        </asp:ScriptManager> 
        <div> 
            <telerik:RadPanelBar ID="RadPanelbar1" runat="server">  
                <CollapseAnimation Duration="100" Type="None" /> 
                <ExpandAnimation Duration="100" Type="None" /> 
                <Items> 
                    <telerik:RadPanelItem runat="server" Expanded="True" Text="Root RadPanelItem1">  
                        <Items> 
                            <telerik:RadPanelItem runat="server">  
                                <ItemTemplate> 
                                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 
                                </ItemTemplate> 
                            </telerik:RadPanelItem> 
                        </Items> 
                    </telerik:RadPanelItem> 
                </Items> 
            </telerik:RadPanelBar> 
        </div> 
    </form> 
</body> 
</html> 


Greetings,
Paul
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
appdev
Top achievements
Rank 1
answered on 13 Oct 2008, 02:22 PM
i still have the same error
and if if i make everything htlm control, i can't seems to retreive the value
like this

 

Dim str2 As String = DirectCast(RadPanelBar1.FindItemByValue("hleeee").("txtFileNameSaveas"), HtmlTextArea).Value.ToString


the error is because it ocudln't find the control since it is html input now not asp control anymore.

 

0
appdev
Top achievements
Rank 1
answered on 13 Oct 2008, 06:45 PM
anyone else could help me? really appreciate it.
0
Paul
Telerik team
answered on 16 Oct 2008, 12:54 PM
Hello Duy,

We are a bit confused by your questions. Are you trying to access the templated control client-side or on the server? Once you are pasting here some JavaScript lines, but now we see VB.NET code-behind. Please try to be more specific on what exactly you are trying to achieve.

All the best,
Paul
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
appdev
Top achievements
Rank 1
answered on 16 Oct 2008, 01:12 PM
i tried to follow your example but it didn't work with javascript. for some reason it kept saying that the control is undefined. So i turned around and tried to use server side but was also successfull. so this is what i did right now. i made the page reload when you click on the button to display asp user controls. then i also put in an ajaxupdate so the users will not really see the page getting reload. that is what i have right now. i know this is not the best way but until i find the answer to my question i have to use that method. hope this clarifies a bit.  thank you for your help.
0
Paul
Telerik team
answered on 16 Oct 2008, 01:23 PM
Hi Duy,

Unfortunately, the provided information does not help us much in reproducing the error. I'm afraid we could not be of much help unless we reproduce the issue on our side. It will be best if you can open a support ticket and send us a simple running project (incl. your custom skin, CSS, images, DB backup if needed and so on) demonstrating the problem (and step-by-step instructions on doing so). In that way we can reproduce and pinpoint the problems you're facing on our side, understand the logic of your application and provide a solution.

Thanks beforehand for your patience and cooperation,
Paul
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
appdev
Top achievements
Rank 1
answered on 16 Oct 2008, 01:25 PM
how do i open a ticket and attach the code to telerik only but noone else?
0
Paul
Telerik team
answered on 16 Oct 2008, 02:11 PM
Hi Duy,

Please refer to the attached screenshots for details.

All the best,
Paul
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
appdev
Top achievements
Rank 1
answered on 18 Oct 2008, 06:27 PM
sorry Paul, i can't do that because i'm only using the trial version to test out stuff. i can't submit the ticket. thanks for trying to help.
Tags
PanelBar
Asked by
appdev
Top achievements
Rank 1
Answers by
Paul
Telerik team
appdev
Top achievements
Rank 1
Share this question
or