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

[Solved] opening window using vb.net

3 Answers 257 Views
Window
This is a migrated thread and some comments may be shown as answers.
TSCGlobal
Top achievements
Rank 1
TSCGlobal asked on 08 Feb 2008, 04:41 PM

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.

3 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 11 Feb 2008, 03:58 PM
Hello Duane,

Here is how to add a new RadWindow Prometheus to the page:

Dim newWindow As New Telerik.Web.UI.RadWindow() 
newWindow.NavigateUrl = "http://www.sitefinity.com" 
'OPTION 1 
'Add the newly created RadWindow to the RadWindowManager's collection 
'WindowManager.Windows.Add(newWindow) 
'OPTION 2 
'since in the "Prometheus" version you can have a RadWindow outside of a RadWindowManager 
'as a separate control, you can add the newly created RadWindow directly to the form's Controls collection 
form1.Controls.Add(newWindow) 


More information on how to create RadWindows and set various properties to them from the server is available in the documentation.



Greetings,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
TSCGlobal
Top achievements
Rank 1
answered on 11 Feb 2008, 05:14 PM
Right, I already have the window added in asp.net. I need to know how to OPEN the window programmatically in vb.net, not add a window. I already have the window set up in asp.net. Window name 'EventDetailWindow'

I want a window to open up based on the provided code in my original post.
0
Accepted
Georgi Tunev
Telerik team
answered on 12 Feb 2008, 03:48 PM
Hi Duane,

In such case (when the RadWindow is already created on the page) you can simply use the ID of the RadWindow and to set its VisibleOnPageLoad property to true.

Session.Add("EventID", EventID)   
'Open EventDetail window (?????)   
EventDetail.VisibleOnPageLoad = true 



Sincerely yours,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Window
Asked by
TSCGlobal
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
TSCGlobal
Top achievements
Rank 1
Share this question
or