第2个回答 2011-07-25
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
BackColor="#77A9CE" BorderColor="#6694B8" BorderStyle="None" BorderWidth="1px"
CellPadding="3" CellSpacing="1" GridLines="None" OnPageIndexChanging="GridView1_PageIndexChanging"
Style="font-size: 12px" Width="50%">
<FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
<Columns>
<asp:TemplateField HeaderText="选择">
<ItemStyle HorizontalAlign="Center" Width="30px" Wrap="True" />
<HeaderStyle BackColor="#6694B8" ForeColor="WhiteSmoke" HorizontalAlign="Center"
Wrap="False" />
<ItemTemplate>
<input id="Radio1" name="Rad" type="radio" value='<%#DataBinder.Eval(Container.DataItem, "BelongCustomer")%>' />
</ItemTemplate>
<FooterStyle Wrap="True" />
</asp:TemplateField>
<asp:BoundField DataField="BelongCustomer" HeaderText="名称" SortExpression="cname">
<HeaderStyle BackColor="#6694B8" ForeColor="WhiteSmoke" Wrap="False" />
</asp:BoundField>
</Columns>
<RowStyle BackColor="#FBFCFE" ForeColor="Black" HorizontalAlign="Center" />
<EmptyDataTemplate>
<div align="center">
<font color="white">无相关数据!</font></div>
</EmptyDataTemplate>
<SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#6694B8" ForeColor="Transparent" HorizontalAlign="Right" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" Wrap="False" />
<AlternatingRowStyle BackColor="#E6EDF7" />
</asp:GridView>
<input id="Button1" onclick="return checkbutton();" type="button" value="确定" />
<input id="Button2" onclick="return closewin();" type="button" value="返回" />
</div>
</form>
</body>
</html>
<script language="javascript">
function checkbutton()
{
var a=0
for(var i=0;i<document.Form1.elements.length;i++)
{
if(document.Form1.elements[i].checked==true)
{
a=a+1;
}
}
if(a==1)
{
sendFromChild();
}
else
{
alert('提交数据失败,未选中项!');
return false;
}
}/////
var getFromParent=window.dialogArguments;
function CheckSelect()
{
for(var i=0;i<window.document.Form1.elements.length;i++)
{
var e = Form1.elements[i];
if (e.checked)
{
return e.value;
}
}
var retrunstr="";
return retrunstr;
}
function sendFromChild()
{
window.returnValue=CheckSelect();
window.close();
}
window.onbeforeunload = function()
{
var n = window.event.screenX - window.screenLeft;
var b = n > document.documentElement.scrollWidth-20;
if(b && window.event.clientY < 0 || window.event.altKey)
{
}
}
//关闭
function closewin()
{
window.returnValue="";
window.close();
}
</script>本回答被提问者和网友采纳