给Button添加客户端事件,对列求各,模版列绑定.
来源:互联网 发布:淘宝店铺图标怎么删除 编辑:程序博客网 时间:2024/05/21 11:11
按某列求和以及绑定下拉列表
int count=0; //总和
for (int i = 0; i < GridView1.Rows.Count; i++)
{
//以下代码绑定下拉列表
DropDownList ddl =(DropDownList)GridView1.Rows[i].Cells[13].FindControl("ddlSex");
bool sex = (bool)ds.Tables[0].Rows[i]["Sex"];
if (ddl != null)
{
if (sex)
ddl.SelectedIndex = 0;
else
ddl.SelectedIndex = 1;
}
//以下代码求和
count += int.Parse(ds.Tables[0].Rows[i]["Score"].ToString());
}
int av = count / ds.Tables[0].Rows.Count;
GridView1.FooterRow.Cells[6].Text = "平均成绩:" + av.ToString();
给Button添加客户端事件
btnDeleteAll.Attributes.Add("onclick","return confirm('你真的要删除所选项吗?')");
读取模版列中控件的值
string studentSex = ((RadioButton)GridView1.Rows[index].Cells[3].FindControl("rbmail")).Checked ? "1" : "0";
string studentSex = ((DropDownList)GridView1.Rows[index].FindControl("ddlSex")).SelectedValue;
RadioButton绑定数库库中Sex字段
<asp:RadioButton ID="rbmail" runat="server" Checked='<%# DataBinder.Eval(Container,"DataItem.Sex") %>' Enabled="False" Text="男" />
<asp:RadioButton ID="rbfemail" runat="server" Checked='<%# !(bool)DataBinder.Eval(Container,"DataItem.Sex") %>' Enabled="False" Text="女" />
删除GridView中的某行时记得再入以下代码!
if (GridView1.Page.Items.Count==1)
{
if (GridView1.PageIndex != 0)
GridView1.PageIndex--;
}
- 给Button添加客户端事件,对列求各,模版列绑定.
- 给button动态绑定click事件
- 对jqgrid的某列绑定事件
- jQuery 给动态添加元素绑定事件
- 给动态添加的元素绑定事件
- C#winform中动态添加button并绑定事件
- Button动态绑定事件
- DataGrid模版列绑定TextBox
- DataGrid模版列绑定CheckBox
- 给button添加响应事件时出错,解决办法
- NGUI 给Button添加事件并调用用户函数
- 【NGUI】Unity中给NGUI添加监听事件,Button,Toggle
- 怎么用block给Button和AlertView添加点击事件
- 给button添加点击事件,打开一个新的窗体
- 【NGUI】Unity中给NGUI添加监听事件,Button,Toggle
- iOS,OC给button添加block点击事件扩展
- 动态创建DataGrid模版列,绑定列
- 给GridView模版列中的按钮的CommandArgument属性绑定值及调用 [转]
- Java 5.0 API中文版(完整版,CHM帮助文档)
- 在jsp页面间传递参数
- Java命令行工具使用
- Intel多核培训感想
- GPRS请教
- 给Button添加客户端事件,对列求各,模版列绑定.
- 编码优化无极限——由一个相等判断想到的
- 圣诞之夜,不胜酒力
- 补充一些linux进程相关的东西
- GIS相关单位网址
- Java笔试题目汇总
- Oracle数据导入导出imp/exp命令
- 乱谈zip、rar文件格式
- 用 83 种语言说“我爱你”