最近在做一个网页界面,是人事考勤方面的,功能是填写一个部门多个员工的请假月报表,大概格式如下人员编码   姓名   出勤工日  小计    病假    事假   婚嫁   产假   摘要  
001        张三      22       1       1      0       0     0     2010-11-25请假一天
002        李四      22       0       0      0       0     0     其中,我的想法是从数据库中仅导出"人员编码"和"姓名"两列并且绑定在gridview控件中,"人员编码"列作为超链接列,而后面的需要填写数据的几个列不用绑定,然后通过点击点击"人员编码"列弹出模式窗口,在模式窗口中填入后面几列数据,提交后关闭模式窗口,并将填写的数据返回到点击的那一行的后面几个列的网格中,但是在提交后不知怎样获取几个返回值;另外,今天尝试使用gridview添加编辑列的方法来解决这个问题,也一直没有解决好,老是无法获取在编辑状态时各个被编辑的网格中的文本框的值,请各位一并赐教,或者提供更好的思路,谢谢!涉及的代码如下:前台:设置超链接列
        <asp:GridView ID="GV" runat="server" AutoGenerateColumns="False" Height="1px"
            Style="z-index: 100; left: 8px; position: absolute; top: 8px" Width="800px" CellPadding="4" Font-Size="Small" ForeColor="#333333">
            <Columns>
                <asp:TemplateField HeaderText="人员编码">
                    <ItemTemplate>
                    <a href="<%# GetUserPageScp(Eval("人员编码")) %>"><%#Eval("人员编码")%></a>
                    </ItemTemplate>
                    <ItemStyle Width="80px" />
                </asp:TemplateField>
                <asp:BoundField DataField="姓名" HeaderText="姓名" >
                    <ItemStyle Width="60px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="出勤工日" >
                    <ItemStyle Width="15px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="小计" >
                    <ItemStyle Width="15px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="病假" >
                    <ItemStyle Width="15px" Wrap="True" />
                </asp:BoundField>
                <asp:BoundField HeaderText="事假">
                    <ItemStyle Width="15px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="婚假">
                    <ItemStyle Width="15px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="产假">
                    <ItemStyle HorizontalAlign="Right" Width="15px" />
                </asp:BoundField>                <asp:BoundField HeaderText="摘要">
                    <ItemStyle Width="100px" />
                </asp:BoundField>
            </Columns>
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#EFF3FB" />
            <EditRowStyle BackColor="#2461BF" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
后台:弹出模式窗口和传递参数
    Protected Function GetuserPageScp(ByVal Rybm As String) As String
        Return "javascript: window.showModalDialog('" + Me.Page.ResolveUrl("Rykqjl.aspx?Rybm=" + Rybm) + "','','dialogHeight:700px;dialogWidth:900px');"
    End Function

解决方案 »

  1.   

      将“弹出模式窗口”改为“以弹出层的方式”
      在弹出层中写需要填的信息,点击弹出层的确定按钮式,执行js代码,将
      数据填到gridview中
      

  2.   

    这个是以隐藏显示的方式弹出添加信息表的  你将它改为“弹出层的方式”就行了<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!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>    <script language="javascript">
            
            var object;
            function ShowValue(currentObject)
            {    
                object = currentObject;
                document .getElementById ("myName").innerText = object.innerText;
                
                document.getElementById ("mydiv").style .display = "block";
            }
            
            function MyConfirm()
            {   
                var valueA = document.getElementById ("aValue").value ;
                var valueB = document.getElementById ("bValue").value ;
                object.parentElement.parentElement.children[1].innerText = valueA;
                object.parentElement.parentElement.children[2].innerText = valueB;
                
                document.getElementById ("mydiv").style .display = "none";
            }
        </script></head>
    <body>
        <form id="form1" runat="server">
        <asp:Repeater ID="Repeater1" runat="server">
            <HeaderTemplate>
                <table>
                    <tr>
                        <th width="100px" align="center">
                            编辑
                        </th>
                        <th width="100px" align="center">
                            A的值
                        </th>
                        <th width="100px" align="center">
                            B的值
                        </th>
                    </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr>
                    <td align="center">
                        <a href="#" onclick="ShowValue(this);">
                            <%#Eval("id") %></a>
                    </td>
                    <td align="center">
                    </td>
                    <td align="center">
                    </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                </table>
            </FooterTemplate>
        </asp:Repeater>
        <br />
        <br />
        <br />
        <div id="mydiv" visible ="false" style ="display :none ;">
            <table>
                <tr>
                    <td>
                        name:<label id="myName"></label>
                    </td>
                </tr>
                <tr>
                    <td>
                        a:<input id="aValue" type="text" />
                    </td>
                </tr>
                <tr>
                    <td>
                        b:<input id="bValue" type="text" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="button" value="确定" onclick="MyConfirm();" />
                    </td>
                </tr>
            </table>
        </div>
        </form>
    </body>
    </html>
      

  3.   

    弹出的模式窗口,嵌套一个ASPX的界面处理这条数据,刷新父窗口。
      

  4.   

    to ds252743641:
        你的方法太棒了,能否将repeater控件替换成gridview并提供代码,谢谢!
      

  5.   

    GridView一样
    <asp:TemplateField HeaderText="人员编码">
      <ItemTemplate>
      <a href="#" onclick="ShowValue(<%# GetUserPageScp(Eval("人员编码")) %>)><%#Eval("人员编码")%></a>
      </ItemTemplate>
      <ItemStyle Width="80px" />
      </asp:TemplateField>
    就这样,你试试