1:怎样消除字段名称 就是当数据分页出来的时候 会把数据库字段名成也会显示出来的
2:我有个分页程序 是用aspx 邦定 aspx.vb的,但是vb里面的调用的sql语句是死的  怎么样让他变成一个变量参数来调用阿付源码split.aspx.vb   谢谢 各位Imports System.Data.SqlClient
Imports System.Data
Imports System.Web.UIPublic Class WebForm1
    Inherits System.Web.UI.Page    Protected WithEvents MyDataGrid As System.Web.UI.WebControls.DataGrid
    Protected WithEvents btnFirst As System.Web.UI.WebControls.LinkButton
    Protected WithEvents btnPrev As System.Web.UI.WebControls.LinkButton
    Protected WithEvents btnNext As System.Web.UI.WebControls.LinkButton
    Protected WithEvents btnLast As System.Web.UI.WebControls.LinkButton
    Protected WithEvents lblCurrentIndex As System.Web.UI.WebControls.Label
    Protected WithEvents lblPageCount As System.Web.UI.WebControls.Label
    Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid#Region " Web Form Designer Generated Code "    'This call is required by the Web Form Designer.
    Private Sub InitializeComponent()    End Sub    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub#End Region    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        btnFirst.Text = "pro"
        btnPrev.Text = "frist"
        btnNext.Text = "beheid"
        btnLast.Text = "last"
        OpenDatabase()
        BindGrid()
    End Sub
    Sub MyDataGrid_Page(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
        Dim startIndex As Integer
        startIndex = MyDataGrid.CurrentPageIndex * MyDataGrid.PageSize
        MyDataGrid.CurrentPageIndex = e.NewPageIndex
        BindGrid()
        ShowStats()
    End Sub    Sub BindGrid()
        Dim myConnection As SqlConnection = cn
        Dim ds As DataSet = New DataSet()
        Dim adapter As SqlDataAdapter = New SqlDataAdapter("Select * from Info_Article where topic=1", myConnection)
        adapter.Fill(ds, "Orders")
        MyDataGrid.DataSource = ds.Tables("Orders").DefaultView
        MyDataGrid.DataBind()
        ShowStats()    End Sub    Sub PagerButtonClick(ByVal sender As Object, ByVal e As EventArgs)
        'used by external paging UI
        Dim arg As String = sender.CommandArgument        Select Case arg
            Case "next"
                If (MyDataGrid.CurrentPageIndex < (MyDataGrid.PageCount - 1)) Then
                    MyDataGrid.CurrentPageIndex += 1
                End If
            Case "prev"
                If (MyDataGrid.CurrentPageIndex > 0) Then
                    MyDataGrid.CurrentPageIndex -= 1
                End If
            Case "last"
                MyDataGrid.CurrentPageIndex = (MyDataGrid.PageCount - 1)
            Case Else
                'page number
                MyDataGrid.CurrentPageIndex = System.Convert.ToInt32(arg)
        End Select
        BindGrid()
        ShowStats()
    End Sub
    Sub ShowStats()
        lblCurrentIndex.Text = "di " + (MyDataGrid.CurrentPageIndex + 1).ToString() + " ye"
        lblPageCount.Text = "zonggong " + MyDataGrid.PageCount.ToString() + " ye"
    End Sub    Public cn As New SqlClient.SqlConnection()
    Public Sub OpenDatabase()
        cn.ConnectionString = "Server=localhost;uid=sa;pwd=;database=data;"
        cn.Open()
    End Sub
End Class

解决方案 »

  1.   

    要是你的意思是表头上显示字段名的话
    在Datagrid 的ShowHeader=false
    或在每个asp:TemplateColumn里面设HeaderText为你想要的
      

  2.   

    http://dotnet.aspx.cc/ShowDetail.aspx?id=B12283DE-DB20-4322-ACCC-12724442808A
      

  3.   

    不好意思 第二个问题解决了 
    我使用了一个asp:lable 来request.querystring(sql语句)
    然后再付值 不知道各位还有什么更好的方式再增加一个问题  就是当DataGrid现实出内容时  前面加一个空白的列 而且这列里面的文字我是可以自己定义的  例如一个符号 一个图片谢谢各位
      

  4.   

    将其showheader的属性设为 false
    BindGrid(string strSql)来传递sql语句
      

  5.   

    你行成的DATASET有个表,把表的每一列的标题去掉,
    我想你是动态绑顶的,如果你想比较简单的去掉的话,你可以在属性生成器中就不要设置标题就好了
      

  6.   

    前面两个都解决了 谢谢各位的 
    现在是最后一个 555 就是当DataGrid显示出内容时  前面加一个空白的列 而且这列里面的文字我是可以自己定义的  例如一个符号 一个图片谢谢各位
      

  7.   

    如果你想动态显示自定义标题,可以在select语句中把列用别名表示
    select colname as alicename from table另一个问题也可以在sql语句中解决,
    select '<img src=.../>' as imgcol,'xxx' as youtextCol from table