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

Error Passing Parameter To Rad Window

2 Answers 107 Views
Window
This is a migrated thread and some comments may be shown as answers.
Tracy
Top achievements
Rank 1
Tracy asked on 31 Jan 2011, 02:33 AM
Hi,

I am opening a rad window from code behind on a button click.   The rad window is used to display the contents of a multi-line text box.  I pass 3 parameters, strErrorId, strFieldName and strFieldValue,  to the window and usually it works fine.  But ,I get the error ' ...is not a valid virtural path' when one of the parameters passed to the window contains the name of an aspx page or is stored with multiple lines.

Does anyone know how I can pass these type of parameters correctly?

Thank you for your help.

For Example:
If the strFieldValue parameter is http://localhost:54807/WebForm6.aspx then I get the error
~/Modules/Central/WBF CTL Large Field Display.aspx?&ErrorId=216ad1a1-d3b8-4ef0-b70d-c4b1b44fa0d8&FieldName=HTTP Reference&FieldValue=http://localhost:54807/WebForm6.aspx' is not a valid virtual path.

If the strFieldValue parameter is Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; InfoPath.2; .NET4.0C; .NET4.0E) then I do not get the error.

If the strFieldValue parameter is the following I also get the error.
HTTP_CACHE_CONTROL:no-cache
HTTP_CONNECTION:Keep-Alive
HTTP_CONTENT_LENGTH:524812
HTTP_CONTENT_TYPE:application/x-www-form-urlencoded
HTTP_ACCEPT:image/jpeg, image/gif, image/pjpeg, application/x-ms-application, application/xaml+xml, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
HTTP_ACCEPT_ENCODING:gzip, deflate
HTTP_ACCEPT_LANGUAGE:en-US
HTTP_COOKIE:ASP.NET_SessionId=ipdmwwfq52c0mmit2vqqif55
HTTP_HOST:localhost:54807
HTTP_REFERER:http://localhost:54807/WebForm6.aspx
HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; InfoPath.2; .NET4.0C; .NET4.0E

 

Below is the code I am using to open the rad widnow
Public Sub ShowFieldDescription(ByVal sender As Object, ByVal e As EventArgs)
       Dim ibtDescription As ImageButton = DirectCast(sender, ImageButton)
       Dim frvView As FormView = DirectCast(ibtDescription.NamingContainer, FormView)
       Dim strFieldName As String = ibtDescription.AlternateText.ToString
       Dim strErrorId As String = DirectCast(frvView.FindControl("ErrorId"), Label).Text
       Dim txtField As TextBox
       Dim strFieldValue As String = ""
       Select Case strFieldName
           Case "Error Description"
               txtField = DirectCast(frvView.FindControl("ErrorDescription"), TextBox)
           Case "Error Comments"
               txtField = DirectCast(frvView.FindControl("ErrorComments"), TextBox)
           Case "HTTP Reference"
               txtField = DirectCast(frvView.FindControl("SourceHTTPReference"), TextBox)
           Case "Form Data"
               txtField = DirectCast(frvView.FindControl("SourceFormData"), TextBox)
           Case "All HTTP Headers"
               txtField = DirectCast(frvView.FindControl("SourceAllHTTPHeaders"), TextBox)
           Case "HTTP User Agent"
               txtField = DirectCast(frvView.FindControl("SourceHTTPUserAgent"), TextBox)
       End Select
       strFieldValue = txtField.Text.ToString
       Dim rwdFieldDisplay As New RadWindow
       Dim strNavigation As String = "~/Modules/Central/WBF CTL Large Field Display.aspx?&ErrorId=" + strErrorId + "&FieldName=" + strFieldName + "&FieldValue=" + strFieldValue
       rwdFieldDisplay.ID = "rwdDisplay"
       rwdFieldDisplay.NavigateUrl = strNavigation
       rwdFieldDisplay.Skin = "Black"
       rwmFieldDescription.Windows.Add(rwdFieldDisplay)

2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Tunev
Telerik team
answered on 03 Feb 2011, 12:41 PM
Hello Tracy,

This error is not directly related to the RadWindow control - you will get the same behavior if you try to assign this Url to any other similar component.
I see 2 problems in the query string:
  1. The first argument (ErrorId) should be passed directly after the "?" symbol - you need to use "&" only for the rest of the arguments.
  2. The main problem which causes the error is that you need to UrlEncode the field value. More information on that subject is available in various places on the Net - for example you can check the MSDN library.
I hope this helps.
Kind regards,
Georgi Tunev
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Tracy
Top achievements
Rank 1
answered on 03 Feb 2011, 07:04 PM
Thank you Georgi I will look at the URLEncode Method.
Tags
Window
Asked by
Tracy
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Tracy
Top achievements
Rank 1
Share this question
or