<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
CellPadding="4" ForeColor="#333333" GridLines="None" OnPageIndexChanging="GridView1_PageIndexChanging"
Width="600px">
<PagerSettings FirstPageText="首页" LastPageText="尾页" Mode="NextPreviousFirstLast"
NextPageText="下一页" PageButtonCount="15" PreviousPageText="上一页" />
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<Columns>
<asp:TemplateField HeaderText="选择">
<ItemStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:CheckBox ID="checkbox" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:ImageField DataImageUrlField="tupian" DataImageUrlFormatString="../shoptup/{0}"
HeaderText="产品图片">
<ControlStyle Height="45px" Width="60px" />
</asp:ImageField>
<asp:HyperLinkField DataNavigateUrlFields="shopid" DataNavigateUrlFormatString="xiangxi.aspx?id={0}"
DataTextField="xinghao" HeaderText="型号" />
<asp:BoundField DataField="pinpai" HeaderText="品牌" />
<asp:BoundField DataField="pinming" HeaderText="品名" />
<asp:BoundField DataField="zuitisheng" HeaderText="最大提升高度" />
</Columns>
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#FFCC66" ForeColor="Black" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Black" HorizontalAlign="Center"
VerticalAlign="Middle" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
这是Gridview内镶嵌checkbox作为商品标记;当我点击下面的商品比较按钮时
<asp:ImageButton
ID="ImageButton4" runat="server" Height="19px" ImageUrl="~/imge/bijia.png" OnClick="ImageButton4_Click" />
实现选中商品详细参数比较;后台代码怎么做呢,请高手们写详细代码;被这事郁闷好几天了啊
CellPadding="4" ForeColor="#333333" GridLines="None" OnPageIndexChanging="GridView1_PageIndexChanging"
Width="600px">
<PagerSettings FirstPageText="首页" LastPageText="尾页" Mode="NextPreviousFirstLast"
NextPageText="下一页" PageButtonCount="15" PreviousPageText="上一页" />
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<Columns>
<asp:TemplateField HeaderText="选择">
<ItemStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:CheckBox ID="checkbox" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:ImageField DataImageUrlField="tupian" DataImageUrlFormatString="../shoptup/{0}"
HeaderText="产品图片">
<ControlStyle Height="45px" Width="60px" />
</asp:ImageField>
<asp:HyperLinkField DataNavigateUrlFields="shopid" DataNavigateUrlFormatString="xiangxi.aspx?id={0}"
DataTextField="xinghao" HeaderText="型号" />
<asp:BoundField DataField="pinpai" HeaderText="品牌" />
<asp:BoundField DataField="pinming" HeaderText="品名" />
<asp:BoundField DataField="zuitisheng" HeaderText="最大提升高度" />
</Columns>
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#FFCC66" ForeColor="Black" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Black" HorizontalAlign="Center"
VerticalAlign="Middle" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
这是Gridview内镶嵌checkbox作为商品标记;当我点击下面的商品比较按钮时
<asp:ImageButton
ID="ImageButton4" runat="server" Height="19px" ImageUrl="~/imge/bijia.png" OnClick="ImageButton4_Click" />
实现选中商品详细参数比较;后台代码怎么做呢,请高手们写详细代码;被这事郁闷好几天了啊
解决方案 »
- ASP.NET Repeater 如何自定义分页,请晒成功源码
- 为什么通过gridview的自定义控件只能获取其他控件的属性,却不能编辑其他控件的属性.
- 如何在不打开浏览器的情况下,执行一个页面中的代码,执行结果要跟打开浏览器执行这个页面的结果一样?
- .NET2.0中有没有现成的.把像"~/aaa.aspx"转换成绝对URL的函数或方法
- 请问一下 有关div的用法问题 谢谢
- 急问!请高手指点,水晶报表中的字段超链接到其他页面用querystring传递中文参数时为什么传递不全?少最后一个字
- 为什么iframe中的内容在当前页显示
- 我在浏览aspx页面时,有时候状态栏的进度条总是显示“正在打开***......”,可窗体已经显示出了啊,是什么原因~~
- 如何在.VB文件中用代码打开一个页面,且此页面是另建IE窗口的?
- 弹出式页面的小问题
- VS2005水晶报表表格线显示的问题.
- 怎么样JS脚本去触发.CS后台代码的函数
{
CheckBox cb = (CheckBox)row.FindControl( "CheckBox2 ");
if (cb.Checked==true)
{
}
}
Button1_Click
{
int num = 0;
foreach(GridViewRow row in GridView1.Rows){
CheckBox chk = row.FindControl("CheckBox1") as CheckBox;
if(chk.Checked) {
string s = row.Cells[10].Text; // 得到选中行的ID
num += int.Parse(s);
}
}
}
var values= [];
for(var i = 0;i<list.length;i++)
{
if(list[i].checked)
values.push(list[i].value);
}
把values转成一个字符串,保存到hidden里面,提交 。
{
int num = 0;
foreach(GridViewRow row in GridView1.Rows){
CheckBox chk = row.FindControl("CheckBox1") as CheckBox;
if(chk.Checked) {
string s = row.Cells[10].Text; // 得到选中行的ID
num += int.Parse(s);
}
}
}