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

passing string from default.aspx to report1.vb

1 Answer 65 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Johnny
Top achievements
Rank 2
Johnny asked on 06 Oct 2011, 08:05 AM
Hello all, i got problem passing string from default.aspx to report1.vb (telerik report code). Im using session to pass the string but it seems that report1.vb couldn't accept the string even when im using System.Web.HttpContext.Current.Session("name"). This is my code for defaultx.aspx and report1.vb

defaultx.aspx
<code>
 If DropDownList1.Text <> "Select" Then
            Session("name") = DropDownList1.SelectedValue.ToString
            Response.Redirect("Webform1.aspx")
        End If
</code>

report1.vb

InitializeComponent()
Dim valueFromDropdown As String = System.Web.HttpContext.Current.Session("name")
Dim objCommand As New SqlCommand
        
objCommand.CommandText = "SELECT * FROM student where Name='" + valueFromDropdown & "'"
objCommand.Connection = New SqlConnection("Data Source=(local)\FT2010;Initial Catalog=student;Integrated Security=True")
objCommand.Connection.Open()

FYI I have insert telerik reportviewer in Webform1.aspx and also set report location in its properties (telerik reportviewer) but when debugging, the error occured "exception has been thrown by the target of an invocation" and it points me to the System.Web.HttpContext.Current.Session("name") code in report1.vb

What im doing wrong here please guide me. Thanks!

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 11 Oct 2011, 08:42 AM
Hi Johnny,

Check the following forum thread that contains a sample report and elaborates on the matter.

Best wishes,
Steve
the Telerik team

Q2’11 SP1 of Telerik Reporting is available for download (see what's new). Get it today.

Tags
General Discussions
Asked by
Johnny
Top achievements
Rank 2
Answers by
Steve
Telerik team
Share this question
or