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!
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!