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

点击GridView中的选择按钮时,DetailsView控件中不能显示相应行的数据?
点击GridView中的选择按钮时,DetailsView控件中不能显示相应行的数据.请问是什么原因?   谢谢!

代码如下:

<asp:Content   ID= "Content1 "   ContentPlaceHolderID= "ContentPlaceHolder1 "   Runat= "Server ">
        <span   style= "font-family:   仿宋_GB2312;   text-decoration:   underline "> <strong> 工程设置 <br   />
               
        </strong> </span> &nbsp; <br   />
        <asp:AccessDataSource   ID= "AccessDataSource1 "   runat= "server "   DataFile= "~/newsdb.mdb "
                SelectCommand= "SELECT   [Id],   [Projectname],   [Remark]   FROM   [project] "   >
            </asp:AccessDataSource>
       
          <asp:AccessDataSource   ID= "AccessDataSource2 "   runat= "server "   DataFile= "~/newsdb.mdb "
                SelectCommand= "SELECT   [Id],   [Projectname],   [Remark]   FROM   [project] "     FilterExpression= "id= '@id ' "     >
                    <FilterParameters>
                    <asp:ControlParameter   Name= "id "   ControlID= "gridview1 "   PropertyName= "selectedvalue "   />
                </FilterParameters>
        </asp:AccessDataSource>
       
        <asp:GridView   ID= "GridView1 "   runat= "server "   DataKeyNames= "Id "   DataMember= "DefaultView "          
        DataSourceID= "AccessDataSource1 "   CellPadding= "4 "   ForeColor= "#333333 "       GridLines= "None "   PageSize= "20 "   AutoGenerateColumns= "False "  
        >
                <Columns>
                        <asp:BoundField   DataField= "Id "   HeaderText= "序号 "   ReadOnly= "True "   SortExpression= "Id "   />
                        <asp:BoundField   DataField= "Projectname "   HeaderText= "工程名称 "   SortExpression= "Projectname "   />
                        <asp:BoundField   DataField= "Remark "   HeaderText= "备注 "   SortExpression= "Remark "   />
                        <asp:CommandField   ShowEditButton= "True "   ButtonType= "Button "   >