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

RadCodeBlock and ControlAdapter

3 Answers 159 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Christian
Top achievements
Rank 1
Christian asked on 24 Feb 2010, 05:23 PM
I currently have am working on encrypting all of the URLs in my web application and was thinking about using a control adapter to find any window.location changes and encrypting the URL.

However I cannot find which properties I would use in order to find out what is inside the RadCodeBlock.  Any ideas?

3 Answers, 1 is accepted

Sort by
0
Kalina
Telerik team
answered on 02 Mar 2010, 09:36 AM
Hello Christian,

The RadScriptBlock does not generate any html markup at the page so there is no option to access its content at the client.

However you can access the script contents of the control at the server. It is represented as a Text property of a Literal which is added at the control collection of the RadScriptBlock.

Best wishes,
Kalina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Christian
Top achievements
Rank 1
answered on 19 Apr 2010, 04:07 PM

You are correct about the literal control that works in some instances.

It appears that if there are RadCodeBlocks with the <%= %> tags though a literal control does not appear in the control collection of the RadCodeBlock

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">  
 
    <script type="text/javascript">  
          
        function CreateEvaluationOpen()  
        {  
            var oWnd = $find("<%=rwCreateEvaluation.ClientID %>");  
            oWnd.setUrl("/Content/Evaluation/Contractor/Create.aspx");  
            oWnd.SetTitle('Loading...');  
            oWnd.show();  
            return false;  
        }  
        
    </script> 
 
</telerik:RadCodeBlock> 
 

How would I get to the script contents of the RadCodeBlock (server side) in those instances?
0
Kalina
Telerik team
answered on 21 Apr 2010, 05:20 PM
Hi Christian,

You can retrieve the controls collection of the RadCodeBlock server-side.

There is only one object if type System.Web.UI.ResourceBasedLiteralControl in it, you can cast this object to LiteralControl and get the script contents as text:

ControlCollection collection = this.RadCodeBlock1.Controls;
foreach (Control item in collection)
{
    LiteralControl _item = item as LiteralControl;
    string codeBlockContent = _item.Text;
}


Regards,
Kalina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
General Discussions
Asked by
Christian
Top achievements
Rank 1
Answers by
Kalina
Telerik team
Christian
Top achievements
Rank 1
Share this question
or