日期:2014-05-19  浏览次数:20398 次

关于GridView 控件的问题
小弟想用GridView读取数据的时候能够直接显示一个删除按钮,但是在做的过程中出现了错误,也不知道要怎么调试,希望高手指教~

代码  

<%@   Page   Language= "C# "   AutoEventWireup= "true "   CodeFile= "AlternateView.aspx.cs "   Inherits= "AlternateView "   %>

<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

<html   xmlns= "http://www.w3.org/1999/xhtml "   >
<head   runat= "server ">
        <title> 无标题页 </title>
</head>
<body>
        <form   id= "form1 "   runat= "server ">
        <div>
                <asp:GridView   ID= "GridView1 "   runat= "server "   AutoGenerateColumns= "False "   DataKeyNames= "UserID "
                        DataSourceID= "SqlDataSource1 "   AllowPaging= "True "   AutoGenerateDeleteButton= "True ">
                        <Columns>
                                <asp:BoundField   DataField= "UserID "   HeaderText= "UserID "   InsertVisible= "False "   ReadOnly= "True "
                                        SortExpression= "UserID "   />
                                <asp:BoundField   DataField= "UserName "   HeaderText= "UserName "   SortExpression= "UserName "   />
                                <asp:BoundField   DataField= "RealName "   HeaderText= "RealName "   SortExpression= "RealName "   />
                                <asp:BoundField   DataField= "Address "   HeaderText= "Address "   SortExpression= "Address "   />
                                <asp:BoundField   DataField= "RoleID "   HeaderText= "RoleID "   SortExpression= "RoleID "   />
                                <asp:CheckBoxField   DataField= "Status "   HeaderText= "Status "   SortExpression= "Status "   />
                                <asp:BoundField   DataField= "CreateDate "   HeaderText= "CreateDate "   SortExpression= "CreateDate "   />
                          &nbs