我用c1gridview属性生成器制成如图c1gridvew(图1),然后再页面中写以下代码
<%@ Page Language="VB" %>
<%@ import Namespace="system.data" %>
<%@ import Namespace="system.data.sqlclient" %>
<%@ Register assembly="C1.Web.Wijmo.Controls.3, Version=3.5.20142.176, Culture=neutral, PublicKeyToken=9b75583953471eea" namespace="C1.Web.Wijmo.Controls.C1GridView" tagprefix="wijmo" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Dim Cnn As SqlConnection
Dim cmd As SqlCommand
'“返回”按钮
Sub Button_Exit_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Response.Redirect("../top.aspx")
End Sub
Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)
If Not IsPostBack Then
'If Session("curruser") = "" Then
' Response.Redirect("../index.aspx")
'End If
BindGrid()
End If
End Sub
Sub BindGrid()
Dim dtcmd As SqlDataAdapter
Dim dt As New DataTable
Dim Str1 As String
Cnn = New SqlConnection(ConfigurationManager.AppSettings("connection"))
'查询楼盘信息
Str1 = "select ButtonIndex,Func_No,Schn,Tchn,AddNew,Modify,Del,Query,Prnt,IconNo,FormName,"
Str1 = Str1 & " Node_Level,Id from W_SysFunc order by ButtonIndex,Id"
dtcmd = New SqlDataAdapter(Str1, Cnn)
dtcmd.Fill(dt)
C1GridView1.DataSource = dt
C1GridView1.DataBind()
dt.Clear()
Cnn.Close()
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>系统功能</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Button ID="Button1" runat="server" OnClick="Button_Exit_Click" Text="返回" />
<div>
</div>
<wijmo:C1GridView ID="C1GridView1" runat="server" AutogenerateColumns="True"
GroupAreaCaption="将这里的一列拖去与那一列分组。" LoadingText="载入中..." >
<Columns>
<wijmo:C1TemplateField HeaderText="菜单ID" >
</wijmo:C1TemplateField>
<wijmo:C1TemplateField HeaderText="菜单名称">
</wijmo:C1TemplateField>
<wijmo:C1TemplateField HeaderText="系统功能">
</wijmo:C1TemplateField>
<wijmo:C1TemplateField HeaderText="提示功能">
</wijmo:C1TemplateField>
<wijmo:C1TemplateField HeaderText="新增">
</wijmo:C1TemplateField>
<wijmo:C1TemplateField HeaderText="修改">
</wijmo:C1TemplateField>
<wijmo:C1TemplateField HeaderText="删除">
</wijmo:C1TemplateField>
<wijmo:C1TemplateField HeaderText="查询">
</wijmo:C1TemplateField>
<wijmo:C1TemplateField HeaderText="打印">
</wijmo:C1TemplateField>
<wijmo:C1TemplateField HeaderText="菜单图标">
</wijmo:C1TemplateField>
<wijmo:C1TemplateField HeaderText="窗体名称">
</wijmo:C1TemplateField>
<wijmo:C1TemplateField HeaderText="节点">
</wijmo:C1TemplateField>
<wijmo:C1TemplateField HeaderText="ID">
</wijmo:C1TemplateField>
</Columns>
</wijmo:C1GridView>
</form>
</body>
</html>
运行后效果如图2,数据没有显示在设定的列内,用什么办法得到如期效果? |