七月所学(asp.net)

1  Radio ButtonGroup Name属性可以把Radio Button区分为不同的组别。

2  Autopostback要求客户端支持JavaScript.否则,该属性不起作用。

3  ASP.NET中不可以用MESSAGEBOXMSGBOX弹出对话框,而应该用脚本语言。

4  可以通过QUERYSTRING(“”)传递来自超级链接的信息。

5  datasource几种形式
    

6        button,linkbutton,imagebutton等的cause validation属性可以控制其是否导致验证。

7        randomsystem命名空间中的一个可以产生的随机数的类。

8        下一个页面指的是服务器再次回传的页面。

9        Page load→事件处理程序→prerender

10     asp.net页面结构

11    ASP.NET中只能有一个<form></form>标签.

12    在默认情况下,几乎所有的ASP.NET控件都能在表单提交之间保持其属性值,即使禁用VIEWSTATE属性,TEXTBOX,RADIOBUTTNLIST这样的表单控件也能保持其属性值.

13    Datagrid分页的实现:

 

 

 '此函数用于绑定数据到DATAGRID
    Private Function BindSourceToGRID(ByVal mysqlcomm As SqlCommand)
        
'事例化一个类,用于返回数据集
        Dim mywebdb1 As New MyWebDb
        
Dim dsAllCourse As New DataSet
        dsAllCourse 
= mywebdb1.GetDS1(mysqlcomm)
        DataGrid1.DataSource 
= dsAllCourse
        DataGrid1.DataBind()
  
End Function




 

14  Datagrid排序的实现:主要是在datagridsortcommand事件中,一是重新绑定,通过SQLORDERBY实现,二是通过dataview.sort=e.sortexpression再把datagrid绑定到dataview.
下面是一个比较完整的datagrid排序分页的代码

=======================分页===================================
Private Sub Page_Load(ByVal sender As System.Object, _
        
ByVal e As System.EventArgs) Handles MyBase.Load
    
With DataGrid1
        .AllowPaging 
= True
        .PagerStyle.Mode 
= PagerMode.NumericPages
        .PageSize 
= 5
        .PagerStyle.PageButtonCount 
= 5
    
End With
    
If IsPostBack Then
        DataSet11 
= CType(Session("dataset"), DataSet1)
    
Else
        SqlDataAdapter1.Fill(DataSet11)
        Session(
"dataset"= DataSet11
        DataBind()
    
End If
End Sub


Private Sub DataGrid1_PageIndexChanged(ByVal source As ObjectByVal e _
        
As System.Web.UI.WebControls.DataGridPageChangedEventArgs) _
        
Handles DataGrid1.PageIndexChanged
    DataGrid1.CurrentPageIndex 
= e.NewPageIndex
    
' If the grid is sorted, reapply the sort expression here.
    DataGrid1.DataBind()
End Sub


===============================排序===============================

Private Sub Page_Load(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles MyBase.Load
        
If IsPostBack Then
            DsNorthwind1 
= CType(Session("dsNorthwind"), dsNorthwind)
        
Else
            SqlDataAdapter1.Fill(DsNorthwind1)
            Session(
"dsNorthwind"= DsNorthwind1
            DataGrid1.DataSource 
= DsNorthwind1.Customers.DefaultView
            DataGrid1.DataMember 
= ""
            DataGrid1.DataBind()
        
End If
    
End Sub


Private Sub DataGrid1_SortCommand(ByVal source As Object, _
      
ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) _
      
Handles DataGrid1.SortCommand
    DataGrid1.DataSource 
= DsNorthwind1.Customers.DefaultView
    DsNorthwind1.Customers.DefaultView.Sort 
= e.SortExpression
    DataGrid1.DataBind()
End Sub


  btn.Attributes.Add(
"onclick""return confirm('你是否

确定删除这条记录');");




posted on 2005-08-03 13:55  天浩  阅读(1270)  评论(4编辑  收藏  举报

导航