问题:下列JS是获取GridView中选中的某一行各列的值,我想把获取到的值由cb返回到另一页面中并自动填到相应的文本框,
在另一页面怎么设置JS获取返回的值?
<script language="javascript">
function show(e)
{
var cb=null;
var aa=e.parentNode.parentNode;
for(var i=1;i<aa.cells.length;i++)
{
cb=aa.cells[i].innerText;
}
window.dialogArguments.setValue(cb);
window.close();
}
</script> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" AllowPaging="true"
BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" PageSize="7"
CellPadding="4" CssClass="css" Width="450px" OnRowDataBound="GridView1_OnRowDataBount" OnPageIndexChanging="GridView1_OnPageIndex">
<PagerSettings FirstPageText="首页" LastPageText="尾页" Mode="NextPreviousFirstLast" NextPageText="下一页" PreviousPageText="上一页" />
<FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
<RowStyle BackColor="White" ForeColor="#003399" />
<Columns>
<asp:TemplateField HeaderText="选择">
<ItemTemplate><asp:CheckBox ID="chk" runat="server" onclick="show(this)" /></ItemTemplate>
<HeaderStyle Wrap="False" />
<ItemStyle HorizontalAlign="Center" Wrap="False" />
</asp:TemplateField>
<asp:BoundField DataField="pn" HeaderText="零件名称" >
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="st" HeaderText="零件规格" >
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="offer" HeaderText="供应商" >
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="price" HeaderText="单价" >
<HeaderStyle Wrap="False" />
<ItemStyle HorizontalAlign="Center" Wrap="False" />
</asp:BoundField>
</Columns>
<PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
<SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
<HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
</asp:GridView>
在另一页面怎么设置JS获取返回的值?
<script language="javascript">
function show(e)
{
var cb=null;
var aa=e.parentNode.parentNode;
for(var i=1;i<aa.cells.length;i++)
{
cb=aa.cells[i].innerText;
}
window.dialogArguments.setValue(cb);
window.close();
}
</script> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" AllowPaging="true"
BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" PageSize="7"
CellPadding="4" CssClass="css" Width="450px" OnRowDataBound="GridView1_OnRowDataBount" OnPageIndexChanging="GridView1_OnPageIndex">
<PagerSettings FirstPageText="首页" LastPageText="尾页" Mode="NextPreviousFirstLast" NextPageText="下一页" PreviousPageText="上一页" />
<FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
<RowStyle BackColor="White" ForeColor="#003399" />
<Columns>
<asp:TemplateField HeaderText="选择">
<ItemTemplate><asp:CheckBox ID="chk" runat="server" onclick="show(this)" /></ItemTemplate>
<HeaderStyle Wrap="False" />
<ItemStyle HorizontalAlign="Center" Wrap="False" />
</asp:TemplateField>
<asp:BoundField DataField="pn" HeaderText="零件名称" >
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="st" HeaderText="零件规格" >
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="offer" HeaderText="供应商" >
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="price" HeaderText="单价" >
<HeaderStyle Wrap="False" />
<ItemStyle HorizontalAlign="Center" Wrap="False" />
</asp:BoundField>
</Columns>
<PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
<SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
<HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
</asp:GridView>
解决方案 »
- 关于TextBox的属性
- 读取html页面的问题
- 求三层结构教程
- 请教一个applicationPool的问题,在IIS6里可以设置空闲关闭的时间,在iis5.1里不行?
- 在一个页面中点击Button1,生成打开一个Word文档,Word文档内容是从是页面中传过来??
- 类似,下网页的效果是怎么实现的??100分,最先答对的给满分。
- 请教
- vs2008/windows 2008系统 使用水晶报表导出MS Word
- ★★ !! File.Delete(path)失败,我晕了??? !! ★★
- 登录时选择用户登录和管理员登录,但用户登录后依然可以看到别的用户信息
- 数组与 cookie
- Page_Load取不到客户端Post过来的值,请问如何解决?
opener.document.getElementById("控件ID").value=aa.cells[i].innerText;
在RowDataBound事件中加
e.row.attributes.add("ondblclick","<script>jsfunction('"+e.row.cells[1].text+"');</script>");
是什么WINForm 好事WEBFORM?JS不好弄哦。除非回调。
你可以传参数啊。或者viewstate