熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

GridView彈出新頁面彈出制定大小位置新窗口

2022-06-13   來源: .NET編程 

  效果圖

方案一簡單的方法新窗口不固定大小
 <asp:GridView ID=GridView runat=server AutoGenerateColumns=False CellPadding= OnRowDeleting=GridView_RowDeleting OnRowEditing=GridView_RowEditing
                        OnRowUpdating=GridView_RowUpdating OnRowCancelingEdit=GridView_RowCancelingEdit BackColor=White BorderColor=#CCCCCC BorderStyle=None BorderWidth=px FontSize=px  >
                        <FooterStyle BackColor=White ForeColor=# />
                        <Columns>
                            <asp:BoundField DataField=身份證號碼 HeaderText=編號 ReadOnly=True />
                            <asp:BoundField DataField=郵政編碼 HeaderText=郵政編碼 SortExpression=郵政編碼 />
                            <asp:BoundField DataField=家庭住址 HeaderText=家庭住址  />
                            <asp:HyperLinkField HeaderText=姓名 Text=姓名 DataNavigateUrlFields=姓名 DataNavigateUrlFormatString=Defaultaspx?GoodsID={} Target=mainframe NavigateUrl=~/Defaultaspx DataTextField=姓名 >
                    </asp:HyperLinkField>
                            <asp:CommandField HeaderText=選擇 ShowSelectButton=True />
                            <asp:CommandField HeaderText=編輯 ShowEditButton=True />
                            <asp:CommandField HeaderText=刪除 ShowDeleteButton=True />
                        </Columns>
                        <RowStyle ForeColor=# />
                        <SelectedRowStyle BackColor=# FontBold=True ForeColor=White />
                        <PagerStyle BackColor=White ForeColor=# HorizontalAlign=Left />
                        <HeaderStyle BackColor=# FontBold=True ForeColor=White />
                    </asp:GridView>
DataNavigateUrlFields是鏈接的字段名DataNavigateUrlFormatString是路徑

  方案二精確控制彈出窗口大小位置
<asp:HyperLinkColumn DataNavigateUrlField=EmployeeID DataNavigateUrlFormatString=javascript:varwin=windowopen(detailaspx?ID={}nullwidth=height=);windowClose();
       DataTextField=LastName HeaderText=LastName></asp:HyperLinkColumn>


From:http://tw.wingwit.com/Article/program/net/201311/11908.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.