본문 바로가기
Web Program/Asp.net Lecture

gridview 에서 popup 링크 걸기

by 현이빈이 2009. 4. 1.
반응형

gridview 에서 하이퍼링크 필드를 추가한다.

.aspx 구현부

<asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="#CC9966"
            BorderStyle="None" BorderWidth="1px" CellPadding="4" DataSourceID="SqlDataSource1" AllowPaging="True" AutoGenerateColumns="False" EmptyDataText="데이터가 없습니다." Width="730px" >
            <RowStyle BackColor="White" ForeColor="#330099" />
            <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
            <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
            <Columns>
              <asp:TemplateField HeaderText="전체선택">               
                <ItemTemplate>
                  <asp:CheckBox ID="chkSelect" runat="server" />
                </ItemTemplate>
                <HeaderTemplate>
                  <input id="chkAll"  onclick="SelectAllCheckboxes(this);" runat="server" type="checkbox" />
                </HeaderTemplate>
              </asp:TemplateField>
              <asp:HyperLinkField DataTextField="FILE_NAME" SortExpression="FILE_NAME" HeaderText="파일명"
             NavigateUrl="javascript:popup('pre_view.aspx', 'preview', 'resizable=no,width=500, height=400, scrollbars=no, status=no');"/>
                <asp:BoundField DataField="FILE_SIZE" HeaderText="크기" SortExpression="FILE_SIZE" />
              <asp:BoundField DataField="REG_DATE" HeaderText="등록일시" SortExpression="REG_DATE" />
              <asp:BoundField DataField="FILE_ID" HeaderText="file id" />
              <asp:BoundField DataField="FILE_PATH" HeaderText="파일 패스" />
            </Columns>
        </asp:GridView>

자바스크립트 구현부

<script language="JavaScript">
<!--
  function popup(pPage,name, Opt) {
    popUpWin = window.open(pPage,name,Opt);
  }
//-->
</script>

반응형