⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defaultvb.aspx.vb

📁 Telerik是很大的第三方软件制造商
💻 VB
字号:

Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.IO


Namespace Telerik.MenuExamplesVBNET.Menu.Examples.Design.AdvancedTemplates
   
   '/ <summary>
   '/ Summary description for DefaultCS.
   '/ </summary>
   Public Class DefaultVB
      Inherits Telerik.QuickStart.XhtmlPage
      Protected RadMenu1 As Telerik.WebControls.RadMenu
      Protected Label1 As System.Web.UI.WebControls.Label
      Private SampleTable As DataTable = Nothing
      
      
      Private Sub CreateSampleTable()
         SampleTable = New DataTable()
         Dim col1 As New DataColumn("UserName", GetType(System.String))
         'col1
         Dim col2 As New DataColumn("UserBirthDay", GetType(System.String))
         Dim col3 As New DataColumn("UserDetails", GetType(System.String))
         SampleTable.Columns.Add(col1)
         SampleTable.Columns.Add(col2)
         SampleTable.Columns.Add(col3)
      End Sub 'CreateSampleTable
      
      Private Sub PopulateSampleTable()
         Dim TmpRow As DataRow = SampleTable.NewRow()
         TmpRow("UserName") = "John Doe"
         TmpRow("UserBirthDay") = "01/01" + "/" + "1963"
         TmpRow("UserDetails") = "No details for that person"
         SampleTable.Rows.Add(TmpRow)
         
         TmpRow = SampleTable.NewRow()
         TmpRow("UserName") = "Hristo Stoichkov"
         TmpRow("UserBirthDay") = "02/08" + "/" + "1966"
         TmpRow("UserDetails") = "The best football player of the 90's"
         SampleTable.Rows.Add(TmpRow)
         
         TmpRow = SampleTable.NewRow()
         TmpRow("UserName") = "Tazz"
         TmpRow("UserBirthDay") = "01/01" + "/" + "1951"
         TmpRow("UserDetails") = "Taz, the tazmanian devil"
         SampleTable.Rows.Add(TmpRow)
      End Sub 'PopulateSampleTable
      
      
      Protected Sub Button1_Click(sender As Object, e As System.EventArgs)
         Dim TmpRow As DataRow = SampleTable.NewRow()
         TmpRow("UserName") = CType(RadMenu1.FindControl("FirsdtName"), TextBox).Text
         Dim TmpDate As DateTime = DateTime.Parse(CType(RadMenu1.FindControl("FirsddtName"), TextBox).Text)
         TmpRow("UserBirthDay") = TmpDate '.Month.ToString() + "/" + TmpDate.Day.ToString() + "/" + DateTime.Now.Year.ToString();
         TmpRow("UserDetails") = CType(RadMenu1.FindControl("FirstNdame"), TextBox).Text
         SampleTable.Rows.Add(TmpRow)
         Dim TmpGrid As DataGrid = CType(RadMenu1.FindControl("DataGrid1"), DataGrid)
         SampleTable.AcceptChanges()
         TmpGrid.DataSource = SampleTable
         TmpGrid.DataBind()
         Session("ExampleTable") = SampleTable
      End Sub 'Button1_Click
      
      
      Public Sub DayRender([source] As [Object], e As DayRenderEventArgs)
         Dim i As Integer
         For i = 0 To SampleTable.Rows.Count - 1
            Dim TmpDate As DateTime = DateTime.Parse(CType(SampleTable.Rows(i)(1), [String]))
            Dim TmpStrDate As [String] = TmpDate.Month.ToString() + "/" + TmpDate.Day.ToString() + "/" + DateTime.Now.Year.ToString()
            If e.Day.Date = DateTime.Parse(TmpStrDate) Then
               e.Cell.BackColor = System.Drawing.Color.Yellow
               e.Cell.ToolTip = CType(SampleTable.Rows(i)(2), [String])
            End If
         Next i
      End Sub 'DayRender
       
      
      Private Sub Page_Load(sender As Object, e As System.EventArgs) Handles MyBase.Load
         If Not IsPostBack Then
            CreateSampleTable()
            PopulateSampleTable()
            Session("ExampleTable") = SampleTable
            Dim TmpGrid As DataGrid = CType(RadMenu1.FindControl("DataGrid1"), DataGrid)
            TmpGrid.DataSource = SampleTable
            TmpGrid.DataBind()
            Dim TmpBtn As Button = CType(RadMenu1.FindControl("Button1"), Button)
            Dim TmpBox As TextBox = CType(RadMenu1.FindControl("FirsddtName"), TextBox)
            TmpBtn.Attributes("onclick") = "return ClientDateValidate('" + TmpBox.ClientID + "');"
            TmpBtn.Attributes("class") = "button"
         Else
            If Not (Session("ExampleTable") Is Nothing) Then
               SampleTable = CType(Session("ExampleTable"), DataTable)
               Dim TmpGrid As DataGrid = CType(RadMenu1.FindControl("DataGrid1"), DataGrid)
               TmpGrid.DataSource = SampleTable
               TmpGrid.DataBind()
            End If
         End If
      End Sub 'Page_Load
      
      
      ' Fixing the calendar control XHTML output.
      Protected Overrides Sub Render(writer As HtmlTextWriter)
         Dim stringWriter As New StringWriter()
         Dim newWriter As New HtmlTextWriter(stringWriter)
         MyBase.Render(newWriter)
         Dim pageHtml As String = stringWriter.ToString()
         pageHtml = pageHtml.Replace("<td align=""Center""", "<td align=""center""")
         pageHtml = pageHtml.Replace("<td align=""Right""", "<td align=""right""")
         pageHtml = pageHtml.Replace("<td align=""Left""", "<td align=""left""")
         writer.Write(pageHtml)
      End Sub 'Render
      Protected Overrides Sub OnInit(e As EventArgs)
         '
         ' CODEGEN: This call is required by the ASP.NET Web Form Designer.
         '
         InitializeComponent()
         MyBase.OnInit(e)
      End Sub 'OnInit
      
      
      '/ <summary>
      '/ Required method for Designer support - do not modify
      '/ the contents of this method with the code editor.
      '/ </summary>
      Private Sub InitializeComponent()
      End Sub 'InitializeComponent
   End Class 'DefaultVB 
End Namespace 'Telerik.MenuExamplesVBNET.Menu.Examples.Design.AdvancedTemplates

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -