2012-10-10 68 views

回答

0

你可以試試這個作爲ascx控制嗎?

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MyGridView1.ascx.cs" Inherits="MyGridView1" %> 

<asp:GridView ID="MyGridView" runat="server" SelectMethod="GetCustomers" PagerSettings-Position="Bottom" 
    AllowSorting="true" AllowPaging="true" PageSize="5" PagerSettings-Visible="true" 
    PagerSettings-Mode="NumericFirstLast" AutoGenerateDeleteButton="true" Caption="MyGridViewControl" 
    CellPadding="4" GridLines="None" ForeColor="#333333"> 
    <AlternatingRowStyle BackColor="White"></AlternatingRowStyle> 
</asp:GridView> 
<asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowModelStateErrors="true" 
    ShowValidationErrors="true" />` 


而在代碼添加SelectMethod控制的後面。註冊<%@ Register Src="~/MyGridView1.ascx" TagPrefix="uc1" TagName="MyGridView1" %>並使用此控件作爲<uc1:mygridview1 runat="server" id="MyGridView1" />

+0

感謝您的回答,但我的方案是不同的我有edit.aspx頁面和edit.aspx內的幾個用戶控件,他們是整體的一部分。我想拆開實體 – tolahs

相關問題