Ok, my current project has expanded considerably...
The original project was to create a schedular that showed the event details/description in a panel below the calendar, but I had focusing issues, namely when I clicked the appointment, and included a; me.lblDetail.Focus() argument, it did not work. As an alternative, I've decided to give RadWindow a spin, and see if it can solve a problem another way.
What I need to know, is how to open a specific window using vb.net on appointmentClick. I have the following code for the Schedular:
| Private Sub EventWindow(ByVal sender As Object, ByVal e As Telerik.Web.UI.SchedulerEventArgs) Handles RadScheduler1.AppointmentClick | |
| Dim EventID As Integer | |
| Dim conn As New SqlConnection() | |
| 'Make DataKeyField in RadScheduler Integer | |
| EventID = CType(e.Appointment.ID, Integer) | |
| Session.Clear() | |
| Session.Add("EventID", EventID) | |
| 'Open EventDetail window (?????) | |
| End Sub | |
In the .aspx file for the EventDetail window, I have the following code in the code behind (which works with calendar):
| Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load | |
| Dim EventID As Integer = HttpContext.Current.Session("catalog").ToString | |
| Dim conn As New SqlConnection() | |
| 'Make DataKeyField in RadScheduler Integer | |
| EventID = Integer.Parse(Session("EventID")) | |
| ' SQL Connection String Event | |
| conn.ConnectionString = "Data Source=domain.domain.com;Initial Catalog=databasename;Persist Security Info=True;User ID=xxxxxxx;Password=xxxxxxxx" | |
| 'open connection | |
| conn.Open() | |
| 'SQL SELECT statement | |
| Dim cmd As New SqlCommand | |
| cmd.CommandType = CommandType.Text | |
| cmd.CommandText = "SELECT EventName, EventDescription FROM dummytable WHERE EventID = @EventID" | |
| cmd.Connection = conn | |
| ' Create a SqlParameter for each parameter in the stored procedure. | |
| cmd.Parameters.AddWithValue("@EventID", EventID) | |
| 'Execute Reader | |
| Dim Reader As SqlDataReader = cmd.ExecuteReader() | |
| While Reader.Read() | |
| With Me | |
| .lblEventName.Text = Reader("EventName").ToString | |
| .lblEventDetail.Text = Reader("EventDescription").ToString | |
| End With | |
| End While | |
| Reader.Close() | |
| End Sub |
I saw the information in your online help about opening a window using java and asp.net, but I think the best way for me is to use vb.net, as it is what i am most familiar with.